¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.jcdm.main.bs.batchInfo.controller; |
| | | |
| | | import java.util.List; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.PutMapping; |
| | | import org.springframework.web.bind.annotation.DeleteMapping; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import com.jcdm.common.annotation.Log; |
| | | import com.jcdm.common.core.controller.BaseController; |
| | | import com.jcdm.common.core.domain.AjaxResult; |
| | | import com.jcdm.common.enums.BusinessType; |
| | | import com.jcdm.main.bs.batchInfo.domain.BsBatchInfo; |
| | | import com.jcdm.main.bs.batchInfo.service.IBsBatchInfoService; |
| | | import com.jcdm.common.utils.poi.ExcelUtil; |
| | | import com.jcdm.common.core.page.TableDataInfo; |
| | | |
| | | /** |
| | | * æ¹æ¬¡ä¿¡æ¯å½å
¥Controller |
| | | * |
| | | * @author Yi |
| | | * @date 2024-10-15 |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/bs/batchInfo") |
| | | public class BsBatchInfoController extends BaseController |
| | | { |
| | | @Autowired |
| | | private IBsBatchInfoService bsBatchInfoService; |
| | | |
| | | /** |
| | | * æ¥è¯¢æ¹æ¬¡ä¿¡æ¯å½å
¥å表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('bs:batchInfo:list')") |
| | | @GetMapping("/list") |
| | | public TableDataInfo list(BsBatchInfo bsBatchInfo) |
| | | { |
| | | startPage(); |
| | | List<BsBatchInfo> list = bsBatchInfoService.selectBsBatchInfoList(bsBatchInfo); |
| | | return getDataTable(list); |
| | | } |
| | | |
| | | /** |
| | | * 导åºæ¹æ¬¡ä¿¡æ¯å½å
¥å表 |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('bs:batchInfo:export')") |
| | | @Log(title = "æ¹æ¬¡ä¿¡æ¯å½å
¥", businessType = BusinessType.EXPORT) |
| | | @PostMapping("/export") |
| | | public void export(HttpServletResponse response, BsBatchInfo bsBatchInfo) |
| | | { |
| | | List<BsBatchInfo> list = bsBatchInfoService.selectBsBatchInfoList(bsBatchInfo); |
| | | ExcelUtil<BsBatchInfo> util = new ExcelUtil<BsBatchInfo>(BsBatchInfo.class); |
| | | util.exportExcel(response, list, "æ¹æ¬¡ä¿¡æ¯å½å
¥æ°æ®"); |
| | | } |
| | | |
| | | /** |
| | | * è·åæ¹æ¬¡ä¿¡æ¯å½å
¥è¯¦ç»ä¿¡æ¯ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('bs:batchInfo:query')") |
| | | @GetMapping(value = "/{id}") |
| | | public AjaxResult getInfo(@PathVariable("id") Long id) |
| | | { |
| | | return success(bsBatchInfoService.selectBsBatchInfoById(id)); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢æ¹æ¬¡ä¿¡æ¯å½å
¥ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('bs:batchInfo:add')") |
| | | @Log(title = "æ¹æ¬¡ä¿¡æ¯å½å
¥", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@RequestBody BsBatchInfo bsBatchInfo) |
| | | { |
| | | return toAjax(bsBatchInfoService.insertBsBatchInfo(bsBatchInfo)); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹æ¹æ¬¡ä¿¡æ¯å½å
¥ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('bs:batchInfo:edit')") |
| | | @Log(title = "æ¹æ¬¡ä¿¡æ¯å½å
¥", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@RequestBody BsBatchInfo bsBatchInfo) |
| | | { |
| | | return toAjax(bsBatchInfoService.updateBsBatchInfo(bsBatchInfo)); |
| | | } |
| | | |
| | | /** |
| | | * å é¤æ¹æ¬¡ä¿¡æ¯å½å
¥ |
| | | */ |
| | | @PreAuthorize("@ss.hasPermi('bs:batchInfo:remove')") |
| | | @Log(title = "æ¹æ¬¡ä¿¡æ¯å½å
¥", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{ids}") |
| | | public AjaxResult remove(@PathVariable Long[] ids) |
| | | { |
| | | return toAjax(bsBatchInfoService.deleteBsBatchInfoByIds(ids)); |
| | | } |
| | | |
| | | @DeleteMapping("/bacthInput/{ids}") |
| | | public AjaxResult bacthInput(@PathVariable Long[] ids) |
| | | { |
| | | return toAjax(bsBatchInfoService.bacthInput(ids)); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.jcdm.main.bs.batchInfo.domain; |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import org.apache.commons.lang3.builder.ToStringBuilder; |
| | | import org.apache.commons.lang3.builder.ToStringStyle; |
| | | import com.jcdm.common.annotation.Excel; |
| | | import com.jcdm.common.core.domain.BaseEntity; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * æ¹æ¬¡ä¿¡æ¯å½å
¥å¯¹è±¡ bs_batch_info |
| | | * |
| | | * @author Yi |
| | | * @date 2024-10-15 |
| | | */ |
| | | public class BsBatchInfo extends BaseEntity |
| | | { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** id */ |
| | | private Long id; |
| | | |
| | | /** ç©æç¼å· */ |
| | | @Excel(name = "ç©æç¼å·") |
| | | private String materialCode; |
| | | |
| | | /** ç©æå称 */ |
| | | @Excel(name = "ç©æå称") |
| | | private String materialName; |
| | | |
| | | /** æ¹æ¬¡ */ |
| | | @Excel(name = "æ¹æ¬¡") |
| | | private String batch; |
| | | |
| | | /** åæ¢æ¶é´ */ |
| | | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | @Excel(name = "åæ¢æ¶é´") |
| | | private Date changeTime; |
| | | |
| | | /** å¤æ³¨ */ |
| | | @Excel(name = "å¤æ³¨") |
| | | private String remarks; |
| | | |
| | | /** å建ç¨æ· */ |
| | | private String createUser; |
| | | |
| | | /** ä¿®æ¹ç¨æ· */ |
| | | private String updateUser; |
| | | |
| | | public void setId(Long id) |
| | | { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Long getId() |
| | | { |
| | | return id; |
| | | } |
| | | public void setMaterialCode(String materialCode) |
| | | { |
| | | this.materialCode = materialCode; |
| | | } |
| | | |
| | | public String getMaterialCode() |
| | | { |
| | | return materialCode; |
| | | } |
| | | public void setMaterialName(String materialName) |
| | | { |
| | | this.materialName = materialName; |
| | | } |
| | | |
| | | public String getMaterialName() |
| | | { |
| | | return materialName; |
| | | } |
| | | public void setBatch(String batch) |
| | | { |
| | | this.batch = batch; |
| | | } |
| | | |
| | | public String getBatch() |
| | | { |
| | | return batch; |
| | | } |
| | | |
| | | public Date getChangeTime() { |
| | | return changeTime; |
| | | } |
| | | |
| | | public void setChangeTime(Date changeTime) { |
| | | this.changeTime = changeTime; |
| | | } |
| | | |
| | | public void setRemarks(String remarks) |
| | | { |
| | | this.remarks = remarks; |
| | | } |
| | | |
| | | public String getRemarks() |
| | | { |
| | | return remarks; |
| | | } |
| | | public void setCreateUser(String createUser) |
| | | { |
| | | this.createUser = createUser; |
| | | } |
| | | |
| | | public String getCreateUser() |
| | | { |
| | | return createUser; |
| | | } |
| | | public void setUpdateUser(String updateUser) |
| | | { |
| | | this.updateUser = updateUser; |
| | | } |
| | | |
| | | public String getUpdateUser() |
| | | { |
| | | return updateUser; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) |
| | | .append("id", getId()) |
| | | .append("materialCode", getMaterialCode()) |
| | | .append("materialName", getMaterialName()) |
| | | .append("batch", getBatch()) |
| | | .append("changeTime", getChangeTime()) |
| | | .append("remarks", getRemarks()) |
| | | .append("createTime", getCreateTime()) |
| | | .append("createUser", getCreateUser()) |
| | | .append("updateTime", getUpdateTime()) |
| | | .append("updateUser", getUpdateUser()) |
| | | .toString(); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.jcdm.main.bs.batchInfo.mapper; |
| | | |
| | | import java.util.List; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.jcdm.main.bs.batchInfo.domain.BsBatchInfo; |
| | | |
| | | /** |
| | | * æ¹æ¬¡ä¿¡æ¯å½å
¥Mapperæ¥å£ |
| | | * |
| | | * @author Yi |
| | | * @date 2024-10-15 |
| | | */ |
| | | public interface BsBatchInfoMapper extends BaseMapper<BsBatchInfo> |
| | | { |
| | | /** |
| | | * æ¥è¯¢æ¹æ¬¡ä¿¡æ¯å½å
¥ |
| | | * |
| | | * @param id æ¹æ¬¡ä¿¡æ¯å½å
¥ä¸»é® |
| | | * @return æ¹æ¬¡ä¿¡æ¯å½å
¥ |
| | | */ |
| | | public BsBatchInfo selectBsBatchInfoById(Long id); |
| | | |
| | | /** |
| | | * æ¥è¯¢æ¹æ¬¡ä¿¡æ¯å½å
¥å表 |
| | | * |
| | | * @param bsBatchInfo æ¹æ¬¡ä¿¡æ¯å½å
¥ |
| | | * @return æ¹æ¬¡ä¿¡æ¯å½å
¥éå |
| | | */ |
| | | public List<BsBatchInfo> selectBsBatchInfoList(BsBatchInfo bsBatchInfo); |
| | | |
| | | /** |
| | | * æ°å¢æ¹æ¬¡ä¿¡æ¯å½å
¥ |
| | | * |
| | | * @param bsBatchInfo æ¹æ¬¡ä¿¡æ¯å½å
¥ |
| | | * @return ç»æ |
| | | */ |
| | | public int insertBsBatchInfo(BsBatchInfo bsBatchInfo); |
| | | |
| | | /** |
| | | * ä¿®æ¹æ¹æ¬¡ä¿¡æ¯å½å
¥ |
| | | * |
| | | * @param bsBatchInfo æ¹æ¬¡ä¿¡æ¯å½å
¥ |
| | | * @return ç»æ |
| | | */ |
| | | public int updateBsBatchInfo(BsBatchInfo bsBatchInfo); |
| | | |
| | | /** |
| | | * å é¤æ¹æ¬¡ä¿¡æ¯å½å
¥ |
| | | * |
| | | * @param id æ¹æ¬¡ä¿¡æ¯å½å
¥ä¸»é® |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteBsBatchInfoById(Long id); |
| | | |
| | | /** |
| | | * æ¹éå é¤æ¹æ¬¡ä¿¡æ¯å½å
¥ |
| | | * |
| | | * @param ids éè¦å é¤çæ°æ®ä¸»é®éå |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteBsBatchInfoByIds(Long[] ids); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.jcdm.main.bs.batchInfo.service; |
| | | |
| | | import java.util.List; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.jcdm.main.bs.batchInfo.domain.BsBatchInfo; |
| | | |
| | | /** |
| | | * æ¹æ¬¡ä¿¡æ¯å½å
¥Serviceæ¥å£ |
| | | * |
| | | * @author Yi |
| | | * @date 2024-10-15 |
| | | */ |
| | | public interface IBsBatchInfoService extends IService<BsBatchInfo> |
| | | { |
| | | /** |
| | | * æ¥è¯¢æ¹æ¬¡ä¿¡æ¯å½å
¥ |
| | | * |
| | | * @param id æ¹æ¬¡ä¿¡æ¯å½å
¥ä¸»é® |
| | | * @return æ¹æ¬¡ä¿¡æ¯å½å
¥ |
| | | */ |
| | | public BsBatchInfo selectBsBatchInfoById(Long id); |
| | | |
| | | /** |
| | | * æ¥è¯¢æ¹æ¬¡ä¿¡æ¯å½å
¥å表 |
| | | * |
| | | * @param bsBatchInfo æ¹æ¬¡ä¿¡æ¯å½å
¥ |
| | | * @return æ¹æ¬¡ä¿¡æ¯å½å
¥éå |
| | | */ |
| | | public List<BsBatchInfo> selectBsBatchInfoList(BsBatchInfo bsBatchInfo); |
| | | |
| | | /** |
| | | * æ°å¢æ¹æ¬¡ä¿¡æ¯å½å
¥ |
| | | * |
| | | * @param bsBatchInfo æ¹æ¬¡ä¿¡æ¯å½å
¥ |
| | | * @return ç»æ |
| | | */ |
| | | public int insertBsBatchInfo(BsBatchInfo bsBatchInfo); |
| | | |
| | | /** |
| | | * ä¿®æ¹æ¹æ¬¡ä¿¡æ¯å½å
¥ |
| | | * |
| | | * @param bsBatchInfo æ¹æ¬¡ä¿¡æ¯å½å
¥ |
| | | * @return ç»æ |
| | | */ |
| | | public int updateBsBatchInfo(BsBatchInfo bsBatchInfo); |
| | | |
| | | /** |
| | | * æ¹éå é¤æ¹æ¬¡ä¿¡æ¯å½å
¥ |
| | | * |
| | | * @param ids éè¦å é¤çæ¹æ¬¡ä¿¡æ¯å½å
¥ä¸»é®éå |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteBsBatchInfoByIds(Long[] ids); |
| | | |
| | | /** |
| | | * å é¤æ¹æ¬¡ä¿¡æ¯å½å
¥ä¿¡æ¯ |
| | | * |
| | | * @param id æ¹æ¬¡ä¿¡æ¯å½å
¥ä¸»é® |
| | | * @return ç»æ |
| | | */ |
| | | public int deleteBsBatchInfoById(Long id); |
| | | |
| | | int bacthInput(Long[] ids); |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.jcdm.main.bs.batchInfo.service.impl; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.Instant; |
| | | import java.util.*; |
| | | import java.util.concurrent.CompletableFuture; |
| | | |
| | | import cn.hutool.http.HttpRequest; |
| | | import cn.hutool.http.HttpResponse; |
| | | import cn.hutool.json.JSONUtil; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.jcdm.common.utils.DateUtils; |
| | | import com.jcdm.main.bs.beatSetting.domain.BsBeatSetting; |
| | | import com.jcdm.main.bs.beatSetting.mapper.BsBeatSettingMapper; |
| | | import com.jcdm.main.bs.beatSetting.service.IBsBeatSettingService; |
| | | import com.jcdm.main.constant.Constants; |
| | | import com.jcdm.main.restful.qingYan.doman.ChildVO; |
| | | import com.jcdm.main.restful.qingYan.doman.ParentVO; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import com.jcdm.main.bs.batchInfo.mapper.BsBatchInfoMapper; |
| | | import com.jcdm.main.bs.batchInfo.domain.BsBatchInfo; |
| | | import com.jcdm.main.bs.batchInfo.service.IBsBatchInfoService; |
| | | |
| | | /** |
| | | * æ¹æ¬¡ä¿¡æ¯å½å
¥Serviceä¸å¡å±å¤ç |
| | | * |
| | | * @author Yi |
| | | * @date 2024-10-15 |
| | | */ |
| | | @Service |
| | | public class BsBatchInfoServiceImpl extends ServiceImpl<BsBatchInfoMapper, BsBatchInfo> implements IBsBatchInfoService |
| | | { |
| | | @Autowired |
| | | private BsBatchInfoMapper bsBatchInfoMapper; |
| | | |
| | | /** |
| | | * æ¥è¯¢æ¹æ¬¡ä¿¡æ¯å½å
¥ |
| | | * |
| | | * @param id æ¹æ¬¡ä¿¡æ¯å½å
¥ä¸»é® |
| | | * @return æ¹æ¬¡ä¿¡æ¯å½å
¥ |
| | | */ |
| | | @Override |
| | | public BsBatchInfo selectBsBatchInfoById(Long id) |
| | | { |
| | | return bsBatchInfoMapper.selectBsBatchInfoById(id); |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢æ¹æ¬¡ä¿¡æ¯å½å
¥å表 |
| | | * |
| | | * @param bsBatchInfo æ¹æ¬¡ä¿¡æ¯å½å
¥ |
| | | * @return æ¹æ¬¡ä¿¡æ¯å½å
¥ |
| | | */ |
| | | @Override |
| | | public List<BsBatchInfo> selectBsBatchInfoList(BsBatchInfo bsBatchInfo) |
| | | { |
| | | return bsBatchInfoMapper.selectBsBatchInfoList(bsBatchInfo); |
| | | } |
| | | |
| | | /** |
| | | * æ°å¢æ¹æ¬¡ä¿¡æ¯å½å
¥ |
| | | * |
| | | * @param bsBatchInfo æ¹æ¬¡ä¿¡æ¯å½å
¥ |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int insertBsBatchInfo(BsBatchInfo bsBatchInfo) |
| | | { |
| | | bsBatchInfo.setChangeTime(DateUtils.getNowDate()); |
| | | bsBatchInfo.setCreateTime(DateUtils.getNowDate()); |
| | | return bsBatchInfoMapper.insertBsBatchInfo(bsBatchInfo); |
| | | } |
| | | |
| | | /** |
| | | * ä¿®æ¹æ¹æ¬¡ä¿¡æ¯å½å
¥ |
| | | * |
| | | * @param bsBatchInfo æ¹æ¬¡ä¿¡æ¯å½å
¥ |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int updateBsBatchInfo(BsBatchInfo bsBatchInfo) |
| | | { |
| | | bsBatchInfo.setUpdateTime(DateUtils.getNowDate()); |
| | | return bsBatchInfoMapper.updateBsBatchInfo(bsBatchInfo); |
| | | } |
| | | |
| | | /** |
| | | * æ¹éå é¤æ¹æ¬¡ä¿¡æ¯å½å
¥ |
| | | * |
| | | * @param ids éè¦å é¤çæ¹æ¬¡ä¿¡æ¯å½å
¥ä¸»é® |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int deleteBsBatchInfoByIds(Long[] ids) |
| | | { |
| | | return bsBatchInfoMapper.deleteBsBatchInfoByIds(ids); |
| | | } |
| | | |
| | | /** |
| | | * å é¤æ¹æ¬¡ä¿¡æ¯å½å
¥ä¿¡æ¯ |
| | | * |
| | | * @param id æ¹æ¬¡ä¿¡æ¯å½å
¥ä¸»é® |
| | | * @return ç»æ |
| | | */ |
| | | @Override |
| | | public int deleteBsBatchInfoById(Long id) |
| | | { |
| | | return bsBatchInfoMapper.deleteBsBatchInfoById(id); |
| | | } |
| | | |
| | | @Override |
| | | public int bacthInput(Long[] ids) { |
| | | Integer sendData = 0; |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | Set<Long> idSet = new HashSet<>(Arrays.asList(ids)); |
| | | List<BsBatchInfo> bsBatchInfos = this.listByIds(idSet); |
| | | for (BsBatchInfo bsBatchInfo : bsBatchInfos) { |
| | | ParentVO parentVO = new ParentVO(); |
| | | parentVO.setSiteCode("3983"); |
| | | parentVO.setRecordId(String.valueOf(Instant.now().toEpochMilli())); |
| | | parentVO.setStationCode("OP165"); |
| | | parentVO.setProductNum(format.format(new Date())); |
| | | parentVO.setTotalResult("1"); |
| | | List<ChildVO> listChildVo = new ArrayList<>(); |
| | | ChildVO childVO = new ChildVO(); |
| | | childVO.setItemCode(bsBatchInfo.getMaterialCode()); |
| | | childVO.setItemType("3"); |
| | | childVO.setItemText(bsBatchInfo.getMaterialName()); |
| | | childVO.setItemValue(bsBatchInfo.getBatch()); |
| | | childVO.setCheckResult("1"); |
| | | childVO.setCheckTime(format.format(new Date())); |
| | | listChildVo.add(childVO); |
| | | parentVO.setCheckList(listChildVo); |
| | | try{ |
| | | CompletableFuture<Void> cp1 = CompletableFuture.runAsync(() -> { |
| | | HttpResponse execute = HttpRequest.post(Constants.FACTORY_EMS_UAT_GET_RUL+"deviceResultFeedback").body(JSONUtil.toJsonStr(parentVO)).execute(); |
| | | System.out.println(execute.body()); |
| | | }); |
| | | }catch (Exception e){ |
| | | System.out.println(e.getMessage()); |
| | | } |
| | | sendData = sendData+1; |
| | | } |
| | | return sendData; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper |
| | | PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" |
| | | "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.jcdm.main.bs.batchInfo.mapper.BsBatchInfoMapper"> |
| | | |
| | | <resultMap type="BsBatchInfo" id="BsBatchInfoResult"> |
| | | <result property="id" column="id" /> |
| | | <result property="materialCode" column="material_code" /> |
| | | <result property="materialName" column="material_name" /> |
| | | <result property="batch" column="batch" /> |
| | | <result property="changeTime" column="change_time" /> |
| | | <result property="remarks" column="remarks" /> |
| | | <result property="createTime" column="create_time" /> |
| | | <result property="createUser" column="create_user" /> |
| | | <result property="updateTime" column="update_time" /> |
| | | <result property="updateUser" column="update_user" /> |
| | | </resultMap> |
| | | |
| | | <sql id="selectBsBatchInfoVo"> |
| | | select id, material_code, material_name, batch, change_time, remarks, create_time, create_user, update_time, update_user from bs_batch_info |
| | | </sql> |
| | | |
| | | <select id="selectBsBatchInfoList" parameterType="BsBatchInfo" resultMap="BsBatchInfoResult"> |
| | | <include refid="selectBsBatchInfoVo"/> |
| | | <where> |
| | | <if test="materialCode != null and materialCode != ''"> and material_code = #{materialCode}</if> |
| | | <if test="materialName != null and materialName != ''"> and material_name like concat('%', #{materialName}, '%')</if> |
| | | <if test="batch != null and batch != ''"> and batch = #{batch}</if> |
| | | </where> |
| | | </select> |
| | | |
| | | <select id="selectBsBatchInfoById" parameterType="Long" resultMap="BsBatchInfoResult"> |
| | | <include refid="selectBsBatchInfoVo"/> |
| | | where id = #{id} |
| | | </select> |
| | | |
| | | <insert id="insertBsBatchInfo" parameterType="BsBatchInfo"> |
| | | insert into bs_batch_info |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">id,</if> |
| | | <if test="materialCode != null">material_code,</if> |
| | | <if test="materialName != null">material_name,</if> |
| | | <if test="batch != null">batch,</if> |
| | | <if test="changeTime != null">change_time,</if> |
| | | <if test="remarks != null">remarks,</if> |
| | | <if test="createTime != null">create_time,</if> |
| | | <if test="createUser != null">create_user,</if> |
| | | <if test="updateTime != null">update_time,</if> |
| | | <if test="updateUser != null">update_user,</if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id},</if> |
| | | <if test="materialCode != null">#{materialCode},</if> |
| | | <if test="materialName != null">#{materialName},</if> |
| | | <if test="batch != null">#{batch},</if> |
| | | <if test="changeTime != null">#{changeTime},</if> |
| | | <if test="remarks != null">#{remarks},</if> |
| | | <if test="createTime != null">#{createTime},</if> |
| | | <if test="createUser != null">#{createUser},</if> |
| | | <if test="updateTime != null">#{updateTime},</if> |
| | | <if test="updateUser != null">#{updateUser},</if> |
| | | </trim> |
| | | </insert> |
| | | |
| | | <update id="updateBsBatchInfo" parameterType="BsBatchInfo"> |
| | | update bs_batch_info |
| | | <trim prefix="SET" suffixOverrides=","> |
| | | <if test="materialCode != null">material_code = #{materialCode},</if> |
| | | <if test="materialName != null">material_name = #{materialName},</if> |
| | | <if test="batch != null">batch = #{batch},</if> |
| | | <if test="changeTime != null">change_time = #{changeTime},</if> |
| | | <if test="remarks != null">remarks = #{remarks},</if> |
| | | <if test="createTime != null">create_time = #{createTime},</if> |
| | | <if test="createUser != null">create_user = #{createUser},</if> |
| | | <if test="updateTime != null">update_time = #{updateTime},</if> |
| | | <if test="updateUser != null">update_user = #{updateUser},</if> |
| | | </trim> |
| | | where id = #{id} |
| | | </update> |
| | | |
| | | <delete id="deleteBsBatchInfoById" parameterType="Long"> |
| | | delete from bs_batch_info where id = #{id} |
| | | </delete> |
| | | |
| | | <delete id="deleteBsBatchInfoByIds" parameterType="String"> |
| | | delete from bs_batch_info where id in |
| | | <foreach item="id" collection="array" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </delete> |
| | | </mapper> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | import request from '@/utils/request' |
| | | |
| | | // æ¥è¯¢æ¹æ¬¡ä¿¡æ¯å½å
¥å表 |
| | | export function listBatchInfo(query) { |
| | | return request({ |
| | | url: '/bs/batchInfo/list', |
| | | method: 'get', |
| | | params: query |
| | | }) |
| | | } |
| | | |
| | | // æ¥è¯¢æ¹æ¬¡ä¿¡æ¯å½å
¥è¯¦ç» |
| | | export function getBatchInfo(id) { |
| | | return request({ |
| | | url: '/bs/batchInfo/' + id, |
| | | method: 'get' |
| | | }) |
| | | } |
| | | |
| | | // æ°å¢æ¹æ¬¡ä¿¡æ¯å½å
¥ |
| | | export function addBatchInfo(data) { |
| | | return request({ |
| | | url: '/bs/batchInfo', |
| | | method: 'post', |
| | | data: data |
| | | }) |
| | | } |
| | | |
| | | // ä¿®æ¹æ¹æ¬¡ä¿¡æ¯å½å
¥ |
| | | export function updateBatchInfo(data) { |
| | | return request({ |
| | | url: '/bs/batchInfo', |
| | | method: 'put', |
| | | data: data |
| | | }) |
| | | } |
| | | |
| | | // å é¤æ¹æ¬¡ä¿¡æ¯å½å
¥ |
| | | export function delBatchInfo(id) { |
| | | return request({ |
| | | url: '/bs/batchInfo/' + id, |
| | | method: 'delete' |
| | | }) |
| | | } |
| | | |
| | | // å é¤æ¹æ¬¡ä¿¡æ¯å½å
¥ |
| | | export function batchInput(id) { |
| | | return request({ |
| | | url: '/bs/batchInfo/bacthInput/' + id, |
| | | method: 'delete' |
| | | }) |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <template> |
| | | <div class="app-container"> |
| | | <el-card class="box-card"> |
| | | <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> |
| | | <el-form-item label="ç©æç¼å·" prop="materialCode"> |
| | | <el-input |
| | | v-model="queryParams.materialCode" |
| | | placeholder="请è¾å
¥ç©æç¼å·" |
| | | clearable |
| | | @keyup.enter.native="handleQuery" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="ç©æå称" prop="materialName"> |
| | | <el-input |
| | | v-model="queryParams.materialName" |
| | | placeholder="请è¾å
¥ç©æå称" |
| | | clearable |
| | | @keyup.enter.native="handleQuery" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item label="æ¹æ¬¡" prop="batch"> |
| | | <el-input |
| | | v-model="queryParams.batch" |
| | | placeholder="请è¾å
¥æ¹æ¬¡" |
| | | clearable |
| | | @keyup.enter.native="handleQuery" |
| | | /> |
| | | </el-form-item> |
| | | <el-form-item style="float: right"> |
| | | <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">æç´¢</el-button> |
| | | <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">éç½®</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | </el-card> |
| | | |
| | | <el-card style="margin-top: 10px" class="box-card"> |
| | | <el-row :gutter="10" class="mb8"> |
| | | <el-col :span="1.5"> |
| | | <el-button |
| | | type="primary" |
| | | plain |
| | | icon="el-icon-plus" |
| | | size="mini" |
| | | @click="handleAdd" |
| | | v-hasPermi="['bs:batchInfo:add']" |
| | | >æ°å¢</el-button> |
| | | </el-col> |
| | | <el-col :span="1.5"> |
| | | <el-button |
| | | type="success" |
| | | plain |
| | | icon="el-icon-edit" |
| | | size="mini" |
| | | :disabled="single" |
| | | @click="handleUpdate" |
| | | v-hasPermi="['bs:batchInfo:edit']" |
| | | >ä¿®æ¹</el-button> |
| | | </el-col> |
| | | <el-col :span="1.5"> |
| | | <el-button |
| | | type="danger" |
| | | plain |
| | | icon="el-icon-delete" |
| | | size="mini" |
| | | :disabled="multiple" |
| | | @click="handleDelete" |
| | | v-hasPermi="['bs:batchInfo:remove']" |
| | | >å é¤</el-button> |
| | | </el-col> |
| | | <el-col :span="1.5"> |
| | | <el-button |
| | | type="danger" |
| | | plain |
| | | icon="el-icon-delete" |
| | | size="mini" |
| | | :disabled="multiple" |
| | | @click="batchInput" |
| | | >æ¹æ¬¡å½å
¥</el-button> |
| | | </el-col> |
| | | <el-col :span="1.5"> |
| | | <el-button |
| | | type="warning" |
| | | plain |
| | | icon="el-icon-download" |
| | | size="mini" |
| | | @click="handleExport" |
| | | v-hasPermi="['bs:batchInfo:export']" |
| | | >导åº</el-button> |
| | | </el-col> |
| | | <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> |
| | | </el-row> |
| | | |
| | | <el-table border v-loading="loading" :data="batchInfoList" @selection-change="handleSelectionChange"> |
| | | <el-table-column type="selection" width="55" align="center" /> |
| | | <el-table-column label="ç©æç¼å·" align="center" prop="materialCode"> |
| | | </el-table-column> |
| | | <el-table-column label="ç©æå称" align="center" prop="materialName"> |
| | | </el-table-column> |
| | | <el-table-column label="æ¹æ¬¡" align="center" prop="batch"> |
| | | </el-table-column> |
| | | <el-table-column label="åæ¢æ¶é´" align="center" prop="changeTime"> |
| | | </el-table-column> |
| | | <el-table-column label="å¤æ³¨" align="center" prop="remarks"> |
| | | </el-table-column> |
| | | <el-table-column width="200" label="æä½" align="center" class-name="small-padding fixed-width"> |
| | | <template slot-scope="scope"> |
| | | <el-button |
| | | size="mini" |
| | | type="success" |
| | | plain |
| | | style="width: 72px" |
| | | icon="el-icon-edit" |
| | | @click="handleUpdate(scope.row)" |
| | | v-hasPermi="['bs:batchInfo:edit']" |
| | | >ä¿®æ¹</el-button> |
| | | <el-button |
| | | size="mini" |
| | | type="danger" |
| | | plain |
| | | style="width: 72px" |
| | | icon="el-icon-delete" |
| | | @click="handleDelete(scope.row)" |
| | | v-hasPermi="['bs:batchInfo:remove']" |
| | | >å é¤</el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | | </el-card> |
| | | |
| | | <pagination |
| | | v-show="total>0" |
| | | :total="total" |
| | | :page.sync="queryParams.pageNum" |
| | | :limit.sync="queryParams.pageSize" |
| | | @pagination="getList" |
| | | /> |
| | | |
| | | <!-- æ·»å æä¿®æ¹æ¹æ¬¡ä¿¡æ¯å½å
¥å¯¹è¯æ¡ --> |
| | | <el-dialog v-dialogpop-up :title="title" :visible.sync="open" width="500px" append-to-body> |
| | | <span slot="title"> |
| | | <i class="el-icon-s-order"></i> |
| | | {{titleName}} |
| | | </span> |
| | | <el-form ref="form" :model="form" :rules="rules" label-width="80px"> |
| | | <el-form-item label="ç©æç¼å·" prop="materialCode"> |
| | | <el-input v-model="form.materialCode" placeholder="请è¾å
¥ç©æç¼å·" /> |
| | | </el-form-item> |
| | | <el-form-item label="ç©æå称" prop="materialName"> |
| | | <el-input v-model="form.materialName" placeholder="请è¾å
¥ç©æå称" /> |
| | | </el-form-item> |
| | | <el-form-item label="æ¹æ¬¡" prop="batch"> |
| | | <el-input v-model="form.batch" placeholder="请è¾å
¥æ¹æ¬¡" /> |
| | | </el-form-item> |
| | | <el-form-item label="å¤æ³¨" prop="remarks"> |
| | | <el-input v-model="form.remarks" placeholder="请è¾å
¥å¤æ³¨" /> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button type="primary" @click="submitForm">ç¡® å®</el-button> |
| | | <el-button @click="cancel">å æ¶</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | | <script> |
| | | import { listBatchInfo, getBatchInfo, delBatchInfo, addBatchInfo, updateBatchInfo, batchInput } from "@/api/main/bs/batchInfo/batchInfo"; |
| | | |
| | | export default { |
| | | name: "BatchInfo", |
| | | data() { |
| | | return { |
| | | // é®ç½©å± |
| | | loading: true, |
| | | titleName: "", |
| | | // éä¸æ°ç» |
| | | ids: [], |
| | | // éå个ç¦ç¨ |
| | | single: true, |
| | | // éå¤ä¸ªç¦ç¨ |
| | | multiple: true, |
| | | // æ¾ç¤ºæç´¢æ¡ä»¶ |
| | | showSearch: true, |
| | | // æ»æ¡æ° |
| | | total: 0, |
| | | // æ¹æ¬¡ä¿¡æ¯å½å
¥è¡¨æ ¼æ°æ® |
| | | batchInfoList: [], |
| | | // å¼¹åºå±æ é¢ |
| | | title: "", |
| | | // æ¯å¦æ¾ç¤ºå¼¹åºå± |
| | | open: false, |
| | | // æ¥è¯¢åæ° |
| | | queryParams: { |
| | | pageNum: 1, |
| | | pageSize: 10, |
| | | materialCode: null, |
| | | materialName: null, |
| | | batch: null, |
| | | }, |
| | | // 表ååæ° |
| | | form: {}, |
| | | // 表åæ ¡éª |
| | | rules: { |
| | | id: [ |
| | | { required: true, message: "idä¸è½ä¸ºç©º", trigger: "blur" } |
| | | ], |
| | | } |
| | | }; |
| | | }, |
| | | created() { |
| | | this.getList(); |
| | | }, |
| | | methods: { |
| | | /** æ¥è¯¢æ¹æ¬¡ä¿¡æ¯å½å
¥å表 */ |
| | | getList() { |
| | | this.loading = true; |
| | | listBatchInfo(this.queryParams).then(response => { |
| | | this.batchInfoList = response.rows; |
| | | this.total = response.total; |
| | | this.loading = false; |
| | | }); |
| | | }, |
| | | // åæ¶æé® |
| | | cancel() { |
| | | this.open = false; |
| | | this.reset(); |
| | | }, |
| | | // 表åéç½® |
| | | reset() { |
| | | this.form = { |
| | | id: null, |
| | | materialCode: null, |
| | | materialName: null, |
| | | batch: null, |
| | | changeTime: null, |
| | | remarks: null, |
| | | createTime: null, |
| | | createUser: null, |
| | | updateTime: null, |
| | | updateUser: null |
| | | }; |
| | | this.resetForm("form"); |
| | | }, |
| | | /** æç´¢æé®æä½ */ |
| | | handleQuery() { |
| | | this.queryParams.pageNum = 1; |
| | | this.getList(); |
| | | }, |
| | | /** éç½®æé®æä½ */ |
| | | resetQuery() { |
| | | this.resetForm("queryForm"); |
| | | this.handleQuery(); |
| | | }, |
| | | // å¤éæ¡éä¸æ°æ® |
| | | handleSelectionChange(selection) { |
| | | this.ids = selection.map(item => item.id) |
| | | this.single = selection.length!==1 |
| | | this.multiple = !selection.length |
| | | }, |
| | | /** æ°å¢æé®æä½ */ |
| | | handleAdd() { |
| | | this.reset(); |
| | | this.open = true; |
| | | this.titleName = "æ·»å æ¹æ¬¡ä¿¡æ¯å½å
¥"; |
| | | }, |
| | | /** ä¿®æ¹æé®æä½ */ |
| | | handleUpdate(row) { |
| | | this.reset(); |
| | | const id = row.id || this.ids |
| | | getBatchInfo(id).then(response => { |
| | | this.form = response.data; |
| | | this.open = true; |
| | | this.titleName = "ä¿®æ¹æ¹æ¬¡ä¿¡æ¯å½å
¥"; |
| | | }); |
| | | }, |
| | | /** æ交æé® */ |
| | | submitForm() { |
| | | this.$refs["form"].validate(valid => { |
| | | if (valid) { |
| | | if (this.form.id != null) { |
| | | updateBatchInfo(this.form).then(response => { |
| | | this.$modal.msgSuccess("ä¿®æ¹æå"); |
| | | this.open = false; |
| | | this.getList(); |
| | | }); |
| | | } else { |
| | | addBatchInfo(this.form).then(response => { |
| | | this.$modal.msgSuccess("æ°å¢æå"); |
| | | this.open = false; |
| | | this.getList(); |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | }, |
| | | /** å é¤æé®æä½ */ |
| | | handleDelete(row) { |
| | | const ids = row.id || this.ids; |
| | | this.$modal.confirm('æ¯å¦ç¡®è®¤å é¤æ¹æ¬¡ä¿¡æ¯å½å
¥ç¼å·ä¸º"' + ids + '"çæ°æ®é¡¹ï¼').then(function() { |
| | | return delBatchInfo(ids); |
| | | }).then(() => { |
| | | this.getList(); |
| | | this.$modal.msgSuccess("å é¤æå"); |
| | | }).catch(() => {}); |
| | | }, |
| | | /** å é¤æé®æä½ */ |
| | | batchInput(row) { |
| | | const ids = row.id || this.ids; |
| | | this.$modal.confirm('æ¯å¦ç¡®è®¤å é¤æ¹æ¬¡ä¿¡æ¯å½å
¥ç¼å·ä¸º"' + ids + '"çæ°æ®é¡¹ï¼').then(function() { |
| | | return batchInput(ids); |
| | | }).then(() => { |
| | | this.getList(); |
| | | this.$modal.msgSuccess("å½å
¥æå"); |
| | | }).catch(() => {}); |
| | | }, |
| | | /** 导åºæé®æä½ */ |
| | | handleExport() { |
| | | this.download('bs/batchInfo/export', { |
| | | ...this.queryParams |
| | | }, `batchInfo_${new Date().getTime()}.xlsx`) |
| | | } |
| | | } |
| | | }; |
| | | </script> |