From c439d98cefdb6c22475aafd18fd394551933e712 Mon Sep 17 00:00:00 2001 From: "DESKTOP-J7ED0MB\\yinjinlu" <411641505@qq.com> Date: Fri, 9 Dec 2022 16:39:27 +0800 Subject: [PATCH] =?UTF-8?q?SN=E7=BC=96=E7=A0=81=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ktg/common/constant/UserConstants.java | 1 + .../ktg/mes/wm/controller/WmSnController.java | 134 +++++++++++ .../main/java/com/ktg/mes/wm/domain/WmSn.java | 218 ++++++++++++++++++ .../com/ktg/mes/wm/mapper/WmSnMapper.java | 68 ++++++ .../com/ktg/mes/wm/service/IWmSnService.java | 68 ++++++ .../mes/wm/service/impl/WmSnServiceImpl.java | 101 ++++++++ .../main/resources/mapper/wm/WmSnMapper.xml | 139 +++++++++++ 7 files changed, 729 insertions(+) create mode 100644 ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmSnController.java create mode 100644 ktg-mes/src/main/java/com/ktg/mes/wm/domain/WmSn.java create mode 100644 ktg-mes/src/main/java/com/ktg/mes/wm/mapper/WmSnMapper.java create mode 100644 ktg-mes/src/main/java/com/ktg/mes/wm/service/IWmSnService.java create mode 100644 ktg-mes/src/main/java/com/ktg/mes/wm/service/impl/WmSnServiceImpl.java create mode 100644 ktg-mes/src/main/resources/mapper/wm/WmSnMapper.xml diff --git a/ktg-common/src/main/java/com/ktg/common/constant/UserConstants.java b/ktg-common/src/main/java/com/ktg/common/constant/UserConstants.java index 03d39fe..5cb845f 100644 --- a/ktg-common/src/main/java/com/ktg/common/constant/UserConstants.java +++ b/ktg-common/src/main/java/com/ktg/common/constant/UserConstants.java @@ -84,6 +84,7 @@ public class UserConstants public static final String MACHINERY_TYPE_CODE="MACHINERY_TYPE_CODE"; public static final String TASK_CODE="TASK_CODE"; public static final String DEFECT_CODE = "DEFECT_CODE"; + public static final String SN_CODE = "SN_CODE"; /** * 单据的状态类型 diff --git a/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmSnController.java b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmSnController.java new file mode 100644 index 0000000..146aa94 --- /dev/null +++ b/ktg-mes/src/main/java/com/ktg/mes/wm/controller/WmSnController.java @@ -0,0 +1,134 @@ +package com.ktg.mes.wm.controller; + +import java.util.Date; +import java.util.List; +import javax.servlet.http.HttpServletResponse; + +import cn.hutool.core.date.DateUtil; +import com.ktg.common.constant.UserConstants; +import com.ktg.system.strategy.AutoCodeUtil; +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.ktg.common.annotation.Log; +import com.ktg.common.core.controller.BaseController; +import com.ktg.common.core.domain.AjaxResult; +import com.ktg.common.enums.BusinessType; +import com.ktg.mes.wm.domain.WmSn; +import com.ktg.mes.wm.service.IWmSnService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; + +/** + * SN码Controller + * + * @author yinjinlu + * @date 2022-12-08 + */ +@RestController +@RequestMapping("/mes/wm/sn") +public class WmSnController extends BaseController +{ + @Autowired + private IWmSnService wmSnService; + + @Autowired + private AutoCodeUtil autoCodeUtil; + + /** + * 查询SN码列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:sn:list')") + @GetMapping("/list") + public TableDataInfo list(WmSn wmSn) + { + startPage(); + List list = wmSnService.selectWmSnList(wmSn); + return getDataTable(list); + } + + /** + * 查询SN码列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:sn:list')") + @GetMapping("/listSn") + public TableDataInfo listSn(WmSn wmSn) + { + startPage(); + List list = wmSnService.selectSnList(wmSn); + return getDataTable(list); + } + + /** + * 导出SN码列表 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:sn:export')") + @Log(title = "SN码", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, WmSn wmSn) + { + List list = wmSnService.selectWmSnList(wmSn); + ExcelUtil util = new ExcelUtil(WmSn.class); + util.exportExcel(response, list, "SN码数据"); + } + + /** + * 获取SN码详细信息 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:sn:query')") + @GetMapping(value = "/{snId}") + public AjaxResult getInfo(@PathVariable("snId") Long snId) + { + return AjaxResult.success(wmSnService.selectWmSnBySnId(snId)); + } + + /** + * 新增SN码 + */ + @PreAuthorize("@ss.hasPermi('mes:wm:sn:add')") + @Log(title = "SN码", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody WmSn wmSn) + { + Date genDate = DateUtil.date(); + wmSn.setGenDate(genDate); + String SNCode= null; + if(wmSn.getSnNum()>0){ + for(int i=0;i + + + + + + + + + + + + + + + + + + + + + + + + + + select sn_id, sn_code, item_id, item_code, item_name, specification, unit_of_measure, batch_code, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from wm_sn + + + + + + + + + + insert into wm_sn + + sn_code, + item_id, + item_code, + item_name, + specification, + unit_of_measure, + batch_code, + remark, + attr1, + attr2, + attr3, + attr4, + create_by, + create_time, + update_by, + update_time, + + + #{snCode}, + #{itemId}, + #{itemCode}, + #{itemName}, + #{specification}, + #{unitOfMeasure}, + #{batchCode}, + #{remark}, + #{attr1}, + #{attr2}, + #{attr3}, + #{attr4}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update wm_sn + + sn_code = #{snCode}, + item_id = #{itemId}, + item_code = #{itemCode}, + item_name = #{itemName}, + specification = #{specification}, + unit_of_measure = #{unitOfMeasure}, + batch_code = #{batchCode}, + remark = #{remark}, + attr1 = #{attr1}, + attr2 = #{attr2}, + attr3 = #{attr3}, + attr4 = #{attr4}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where sn_id = #{snId} + + + + delete from wm_sn where sn_id = #{snId} + + + + delete from wm_sn where sn_id in + + #{snId} + + + \ No newline at end of file