Browse Source

解决导入表名与字段名相同导入失败问题,销售订单根据色号排序接口,修改码单管理打码逻辑、物料流转功能接口

xuezizhuo 1 year ago
parent
commit
382e35b247
19 changed files with 948 additions and 48 deletions
  1. 1 1
      zkqy-admin/src/main/java/com/zkqy/web/controller/common/CommonFileController.java
  2. 113 0
      zkqy-custom-business/src/main/java/com/zkqy/business/controller/MaterialFlowController.java
  3. 9 0
      zkqy-custom-business/src/main/java/com/zkqy/business/controller/MaterielController.java
  4. 19 1
      zkqy-custom-business/src/main/java/com/zkqy/business/controller/ProductCodeListController.java
  5. 248 0
      zkqy-custom-business/src/main/java/com/zkqy/business/domain/MaterialFlow.java
  6. 11 0
      zkqy-custom-business/src/main/java/com/zkqy/business/domain/vo/ProductCodeListVO.java
  7. 61 0
      zkqy-custom-business/src/main/java/com/zkqy/business/mapper/MaterialFlowMapper.java
  8. 5 0
      zkqy-custom-business/src/main/java/com/zkqy/business/mapper/MaterielMapper.java
  9. 9 1
      zkqy-custom-business/src/main/java/com/zkqy/business/mapper/ProductCodeListMapper.java
  10. 62 0
      zkqy-custom-business/src/main/java/com/zkqy/business/service/IMaterialFlowService.java
  11. 5 0
      zkqy-custom-business/src/main/java/com/zkqy/business/service/IMaterielService.java
  12. 10 1
      zkqy-custom-business/src/main/java/com/zkqy/business/service/IProductCodeListService.java
  13. 177 0
      zkqy-custom-business/src/main/java/com/zkqy/business/service/impl/MaterialFlowServiceImpl.java
  14. 6 0
      zkqy-custom-business/src/main/java/com/zkqy/business/service/impl/MaterielServiceImpl.java
  15. 35 33
      zkqy-custom-business/src/main/java/com/zkqy/business/service/impl/ProductCodeListServiceImpl.java
  16. 3 3
      zkqy-custom-business/src/main/resources/mapper/MaterialCirculationMapper.xml
  17. 134 0
      zkqy-custom-business/src/main/resources/mapper/business/MaterialFlowMapper.xml
  18. 5 0
      zkqy-custom-business/src/main/resources/mapper/business/MaterielMapper.xml
  19. 35 8
      zkqy-custom-business/src/main/resources/mapper/business/ProductCodeListMapper.xml

+ 1 - 1
zkqy-admin/src/main/java/com/zkqy/web/controller/common/CommonFileController.java

@@ -225,7 +225,7 @@ public class CommonFileController {
             fieldMap.forEach((mKey, mVal) -> {
                 if (!mKey.contains("@")) {
                     // 表示列名 删除掉表名称
-                    endFieldMap.put(mVal.toString(), mKey.replace(tableName + "_", ""));
+                    endFieldMap.put(mVal.toString(), mKey.replaceFirst(tableName + "_", ""));
                 } else {
                     // 定义新的title map集合
                     Map<String, String> map = listMap.get(0);

+ 113 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/controller/MaterialFlowController.java

@@ -0,0 +1,113 @@
+package com.zkqy.business.controller;
+
+import java.util.List;
+import javax.servlet.http.HttpServletResponse;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+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.zkqy.common.annotation.Log;
+import com.zkqy.common.core.controller.BaseController;
+import com.zkqy.common.core.domain.AjaxResult;
+import com.zkqy.common.enums.BusinessType;
+import com.zkqy.business.domain.MaterialFlow;
+import com.zkqy.business.service.IMaterialFlowService;
+import com.zkqy.common.utils.poi.ExcelUtil;
+import com.zkqy.common.core.page.TableDataInfo;
+
+/**
+ * 物料流转-新Controller
+ *
+ * @author zkqy
+ * @date 2024-05-09
+ */
+@RestController
+@RequestMapping("/system/MaterialFlow")
+@Api(value = "/system/MaterialFlow", description = "物料流转-新-接口")
+public class MaterialFlowController extends BaseController
+{
+    @Autowired
+    private IMaterialFlowService materialFlowService;
+
+    /**
+     * 查询物料流转-新列表
+     */
+    //@PreAuthorize("@ss.hasPermi('system:MaterialFlow:list')")
+    @GetMapping("/list")
+    @ApiOperation(value = "查询物料流转-新列表")
+    public TableDataInfo list(MaterialFlow materialFlow)
+    {
+        startPage();
+        List<MaterialFlow> list = materialFlowService.selectMaterialFlowList(materialFlow);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出物料流转-新列表
+     */
+    @PreAuthorize("@ss.hasPermi('system:MaterialFlow:export')")
+    @Log(title = "物料流转-新", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    @ApiOperation(value = "导出物料流转-新列表")
+    public void export(HttpServletResponse response, MaterialFlow materialFlow)
+    {
+        List<MaterialFlow> list = materialFlowService.selectMaterialFlowList(materialFlow);
+        ExcelUtil<MaterialFlow> util = new ExcelUtil<MaterialFlow>(MaterialFlow.class);
+        util.exportExcel(response, list, "物料流转-新数据");
+    }
+
+    /**
+     * 获取物料流转-新详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('system:MaterialFlow:query')")
+    @GetMapping(value = "/{id}")
+    @ApiOperation(value = "获取物料流转-新详细信息")
+    public AjaxResult getInfo(@PathVariable("id") Long id)
+    {
+        return success(materialFlowService.selectMaterialFlowById(id));
+    }
+
+    /**
+     * 新增物料流转-新
+     */
+    @PreAuthorize("@ss.hasPermi('system:MaterialFlow:add')")
+    @Log(title = "物料流转-新", businessType = BusinessType.INSERT)
+    @PostMapping
+    @ApiOperation(value = "新增物料流转-新")
+    public AjaxResult add(@RequestBody List<MaterialFlow> materialFlowList)
+    {
+        return materialFlowService.insertMaterialFlow(materialFlowList);
+    }
+
+    /**
+     * 修改物料流转-新
+     */
+    @PreAuthorize("@ss.hasPermi('system:MaterialFlow:edit')")
+    @Log(title = "物料流转-新", businessType = BusinessType.UPDATE)
+    @PutMapping
+    @ApiOperation(value = "修改物料流转-新")
+    public AjaxResult edit(@RequestBody MaterialFlow materialFlow)
+    {
+        return toAjax(materialFlowService.updateMaterialFlow(materialFlow));
+    }
+
+    /**
+     * 删除物料流转-新
+     */
+    @PreAuthorize("@ss.hasPermi('system:MaterialFlow:remove')")
+    @Log(title = "物料流转-新", businessType = BusinessType.DELETE)
+    @DeleteMapping("/{ids}")
+    @ApiOperation(value = "删除物料流转-新")
+    public AjaxResult remove(@PathVariable Long[] ids)
+    {
+        return toAjax(materialFlowService.deleteMaterialFlowByIds(ids));
+    }
+}

+ 9 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/controller/MaterielController.java

@@ -123,4 +123,13 @@ public class MaterielController extends BaseController
     {
         return toAjax(materielService.deleteMaterielByIds(ids));
     }
+
+    /**
+     * 销售订单查询色号并根据色号排序
+     */
+    @GetMapping("/queryMaterielList")
+    public AjaxResult queryMaterielList(){
+        return AjaxResult.success(materielService.queryMaterielList());
+    }
+
 }

+ 19 - 1
zkqy-custom-business/src/main/java/com/zkqy/business/controller/ProductCodeListController.java

@@ -89,6 +89,15 @@ public class ProductCodeListController extends BaseController
         return success(productCodeListService.selectProductCodeListById(id));
     }
 
+    /***
+     * 根据qrCode查询产品码单信息
+     */
+    @GetMapping("/queryCodeListByQrCode/{qrCode}")
+    public AjaxResult queryCodeListByQrCode(@PathVariable("qrCode") String qrCode){
+        return success(productCodeListService.selectProductCodeListByQrCode(qrCode));
+    }
+
+
     /**
      * 新增产品码单
      */
@@ -128,7 +137,7 @@ public class ProductCodeListController extends BaseController
     @Log(title = "产品码单", businessType = BusinessType.DELETE)
     @DeleteMapping("/{ids}")
     @ApiOperation(value = "删除产品码单")
-    public AjaxResult remove(@PathVariable Long[] ids)
+    public AjaxResult remove(@PathVariable String[] ids)
     {
         return toAjax(productCodeListService.deleteProductCodeListByIds(ids));
     }
@@ -149,4 +158,13 @@ public class ProductCodeListController extends BaseController
         return AjaxResult.success(productCodeListService.selectMaxCodeList());
     }
 
+
+    /**
+     * 获取当前码单完整信息
+     */
+    @GetMapping("/getProductCodeListById/{id}")
+    public AjaxResult getProductCodeListById(@PathVariable("id") Long id){
+        return AjaxResult.success(productCodeListService.getProductCodeListById(id));
+    }
+
 }

+ 248 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/domain/MaterialFlow.java

@@ -0,0 +1,248 @@
+package com.zkqy.business.domain;
+
+import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.zkqy.common.core.domain.BaseEntity;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+import com.zkqy.common.annotation.Excel;
+
+/**
+ * 物料流转-新对象 material_flow
+ * 
+ * @author zkqy
+ * @date 2024-05-09
+ */
+public class MaterialFlow extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 编号 */
+    private Long id;
+
+    /** 码单号 */
+    @Excel(name = "码单号")
+    private String qrCode;
+
+    /** 码单唯一标识 */
+    @Excel(name = "码单唯一标识")
+    private String qrCodeId;
+
+    /** 批号 */
+    @Excel(name = "批号")
+    private String lotNum;
+
+    /** 产品编号 */
+    @Excel(name = "产品编号")
+    private Long productId;
+
+    /** 品名 */
+    @Excel(name = "品名")
+    private String productName;
+
+    /** 产品规格 */
+    @Excel(name = "产品规格")
+    private String productSpecifications;
+
+    /** 产品色泽 */
+    @Excel(name = "产品色泽")
+    private String productColour;
+
+    /** 产品类型 */
+    @Excel(name = "产品类型")
+    private String productType;
+
+    /** 重量 */
+    @Excel(name = "重量")
+    private Double productWeight;
+
+    /** 工序 */
+    @Excel(name = "工序")
+    private String procedures;
+
+    /** 流转时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd")
+    @Excel(name = "流转时间", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date transferTime;
+
+    /** 流转人 */
+    @Excel(name = "流转人")
+    private String transferPeople;
+
+    /** 创建者ID */
+    private Long createById;
+
+    /** 更新者ID */
+    private Long updateById;
+
+    /** 删除标志(0:否;2:是) */
+    private String delFlag;
+
+    public void setId(Long id) 
+    {
+        this.id = id;
+    }
+
+    public Long getId() 
+    {
+        return id;
+    }
+    public void setLotNum(String lotNum) 
+    {
+        this.lotNum = lotNum;
+    }
+
+    public String getLotNum() 
+    {
+        return lotNum;
+    }
+    public void setProductId(Long productId) 
+    {
+        this.productId = productId;
+    }
+
+    public Long getProductId() 
+    {
+        return productId;
+    }
+    public void setProductName(String productName) 
+    {
+        this.productName = productName;
+    }
+
+    public String getProductName() 
+    {
+        return productName;
+    }
+    public void setProductSpecifications(String productSpecifications) 
+    {
+        this.productSpecifications = productSpecifications;
+    }
+
+    public String getProductSpecifications() 
+    {
+        return productSpecifications;
+    }
+    public void setProductColour(String productColour) 
+    {
+        this.productColour = productColour;
+    }
+
+    public String getProductColour() 
+    {
+        return productColour;
+    }
+    public void setProductType(String productType) 
+    {
+        this.productType = productType;
+    }
+
+    public String getProductType() 
+    {
+        return productType;
+    }
+    public void setProductWeight(Double productWeight)
+    {
+        this.productWeight = productWeight;
+    }
+
+    public Double getProductWeight()
+    {
+        return productWeight;
+    }
+    public void setProcedures(String procedures)
+    {
+        this.procedures = procedures;
+    }
+
+    public String getProcedures()
+    {
+        return procedures;
+    }
+    public void setTransferTime(Date transferTime) 
+    {
+        this.transferTime = transferTime;
+    }
+
+    public Date getTransferTime() 
+    {
+        return transferTime;
+    }
+    public void setTransferPeople(String transferPeople) 
+    {
+        this.transferPeople = transferPeople;
+    }
+
+    public String getTransferPeople() 
+    {
+        return transferPeople;
+    }
+    public void setCreateById(Long createById) 
+    {
+        this.createById = createById;
+    }
+
+    public Long getCreateById() 
+    {
+        return createById;
+    }
+    public void setUpdateById(Long updateById) 
+    {
+        this.updateById = updateById;
+    }
+
+    public Long getUpdateById() 
+    {
+        return updateById;
+    }
+    public void setDelFlag(String delFlag) 
+    {
+        this.delFlag = delFlag;
+    }
+
+    public String getDelFlag() 
+    {
+        return delFlag;
+    }
+
+    public String getQrCode() {
+        return qrCode;
+    }
+
+    public void setQrCode(String qrCode) {
+        this.qrCode = qrCode;
+    }
+
+    public String getQrCodeId() {
+        return qrCodeId;
+    }
+
+    public void setQrCodeId(String qrCodeId) {
+        this.qrCodeId = qrCodeId;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("id", getId())
+            .append("lotNum", getLotNum())
+            .append("productId", getProductId())
+            .append("productName", getProductName())
+            .append("productSpecifications", getProductSpecifications())
+            .append("productColour", getProductColour())
+            .append("productType", getProductType())
+            .append("productWeight", getProductWeight())
+            .append("procedures", getProcedures())
+            .append("transferTime", getTransferTime())
+            .append("transferPeople", getTransferPeople())
+            .append("remark", getRemark())
+            .append("createBy", getCreateBy())
+            .append("createById", getCreateById())
+            .append("createTime", getCreateTime())
+            .append("updateBy", getUpdateBy())
+            .append("updateById", getUpdateById())
+            .append("updateTime", getUpdateTime())
+            .append("delFlag", getDelFlag())
+            .toString();
+    }
+}

+ 11 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/domain/vo/ProductCodeListVO.java

@@ -143,6 +143,9 @@ public class ProductCodeListVO extends BaseEntity
     /** 通知单号 */
     private String noticeNumber;
 
+    /** 产品分类 */
+    private String productType;
+
     public Long getId() {
         return id;
     }
@@ -485,6 +488,14 @@ public class ProductCodeListVO extends BaseEntity
         this.productColour = productColour;
     }
 
+    public String getProductType() {
+        return productType;
+    }
+
+    public void setProductType(String productType) {
+        this.productType = productType;
+    }
+
     @Override
     public String toString() {
         return "ProductCodeListVO{" +

+ 61 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/mapper/MaterialFlowMapper.java

@@ -0,0 +1,61 @@
+package com.zkqy.business.mapper;
+
+import java.util.List;
+import com.zkqy.business.domain.MaterialFlow;
+
+/**
+ * 物料流转-新Mapper接口
+ * 
+ * @author zkqy
+ * @date 2024-05-09
+ */
+public interface MaterialFlowMapper 
+{
+    /**
+     * 查询物料流转-新
+     * 
+     * @param id 物料流转-新主键
+     * @return 物料流转-新
+     */
+    public MaterialFlow selectMaterialFlowById(Long id);
+
+    /**
+     * 查询物料流转-新列表
+     * 
+     * @param materialFlow 物料流转-新
+     * @return 物料流转-新集合
+     */
+    public List<MaterialFlow> selectMaterialFlowList(MaterialFlow materialFlow);
+
+    /**
+     * 新增物料流转-新
+     * 
+     * @param materialFlow 物料流转-新
+     * @return 结果
+     */
+    public int insertMaterialFlow(MaterialFlow materialFlow);
+
+    /**
+     * 修改物料流转-新
+     * 
+     * @param materialFlow 物料流转-新
+     * @return 结果
+     */
+    public int updateMaterialFlow(MaterialFlow materialFlow);
+
+    /**
+     * 删除物料流转-新
+     * 
+     * @param id 物料流转-新主键
+     * @return 结果
+     */
+    public int deleteMaterialFlowById(Long id);
+
+    /**
+     * 批量删除物料流转-新
+     * 
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteMaterialFlowByIds(Long[] ids);
+}

+ 5 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/mapper/MaterielMapper.java

@@ -68,4 +68,9 @@ public interface MaterielMapper
      * @return 结果
      */
     public int deleteMaterielByIds(Long[] ids);
+
+    /**
+     * 销售订单查询色号并根据色号排序
+     */
+    List<Materiel> queryMaterielList();
 }

+ 9 - 1
zkqy-custom-business/src/main/java/com/zkqy/business/mapper/ProductCodeListMapper.java

@@ -58,7 +58,7 @@ public interface ProductCodeListMapper
      * @param ids 需要删除的数据主键集合
      * @return 结果
      */
-    public int deleteProductCodeListByIds(Long[] ids);
+    public int deleteProductCodeListByIds(String[] ids);
 
     /**
      * 查询生产完成的产品
@@ -70,6 +70,14 @@ public interface ProductCodeListMapper
      */
     String selectMaxCodeList();
 
+    /**
+     * 根据码单号查询码单信息
+     */
+    List<ProductCodeList> selectProductCodeListByQrCode(String qrCode);
 
+    /**
+     * 获取当前吗码单完整信息
+     */
+    ProductCodeListVO getProductCodeListById(Long id);
 
 }

+ 62 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/service/IMaterialFlowService.java

@@ -0,0 +1,62 @@
+package com.zkqy.business.service;
+
+import java.util.List;
+import com.zkqy.business.domain.MaterialFlow;
+import com.zkqy.common.core.domain.AjaxResult;
+
+/**
+ * 物料流转-新Service接口
+ * 
+ * @author zkqy
+ * @date 2024-05-09
+ */
+public interface IMaterialFlowService 
+{
+    /**
+     * 查询物料流转-新
+     * 
+     * @param id 物料流转-新主键
+     * @return 物料流转-新
+     */
+    public MaterialFlow selectMaterialFlowById(Long id);
+
+    /**
+     * 查询物料流转-新列表
+     * 
+     * @param materialFlow 物料流转-新
+     * @return 物料流转-新集合
+     */
+    public List<MaterialFlow> selectMaterialFlowList(MaterialFlow materialFlow);
+
+    /**
+     * 新增物料流转-新
+     * 
+     * @param materialFlowList 物料流转-新
+     * @return 结果
+     */
+    AjaxResult insertMaterialFlow(List<MaterialFlow> materialFlowList);
+
+    /**
+     * 修改物料流转-新
+     * 
+     * @param materialFlow 物料流转-新
+     * @return 结果
+     */
+    public int updateMaterialFlow(MaterialFlow materialFlow);
+
+    /**
+     * 批量删除物料流转-新
+     * 
+     * @param ids 需要删除的物料流转-新主键集合
+     * @return 结果
+     */
+    public int deleteMaterialFlowByIds(Long[] ids);
+
+    /**
+     * 删除物料流转-新信息
+     * 
+     * @param id 物料流转-新主键
+     * @return 结果
+     */
+    public int deleteMaterialFlowById(Long id);
+}

+ 5 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/service/IMaterielService.java

@@ -66,4 +66,9 @@ public interface IMaterielService
      * @return 结果
      */
     public int deleteMaterielById(Long id);
+
+    /**
+     * 销售订单查询色号并根据色号排序
+     */
+    List<Materiel> queryMaterielList();
 }

+ 10 - 1
zkqy-custom-business/src/main/java/com/zkqy/business/service/IProductCodeListService.java

@@ -50,7 +50,7 @@ public interface IProductCodeListService
      * @param ids 需要删除的产品码单主键集合
      * @return 结果
      */
-    public int deleteProductCodeListByIds(Long[] ids);
+    public int deleteProductCodeListByIds(String[] ids);
 
     /**
      * 删除产品码单信息
@@ -70,5 +70,14 @@ public interface IProductCodeListService
      */
     String selectMaxCodeList();
 
+    /**
+     * 根据码单号查询码单信息
+     */
+    List<ProductCodeList> selectProductCodeListByQrCode(String qrCode);
+
+    /**
+     * 根据编号获取码单完整信息
+     */
+    ProductCodeListVO getProductCodeListById(Long id);
 
 }

+ 177 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/service/impl/MaterialFlowServiceImpl.java

@@ -0,0 +1,177 @@
+package com.zkqy.business.service.impl;
+
+import java.text.DecimalFormat;
+import java.util.List;
+
+import com.zkqy.business.domain.ProductInventory;
+import com.zkqy.business.domain.ProductWarehousingRecord;
+import com.zkqy.business.mapper.ProductCodeListMapper;
+import com.zkqy.business.mapper.ProductInventoryMapper;
+import com.zkqy.business.mapper.ProductWarehousingRecordMapper;
+import com.zkqy.common.core.domain.AjaxResult;
+import com.zkqy.common.utils.DateUtils;
+import com.zkqy.common.utils.SecurityUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.zkqy.business.mapper.MaterialFlowMapper;
+import com.zkqy.business.domain.MaterialFlow;
+import com.zkqy.business.service.IMaterialFlowService;
+import org.springframework.transaction.annotation.Transactional;
+
+/**
+ * 物料流转-新Service业务层处理
+ * 
+ * @author zkqy
+ * @date 2024-05-09
+ */
+@Service
+public class MaterialFlowServiceImpl implements IMaterialFlowService 
+{
+    @Autowired
+    private MaterialFlowMapper materialFlowMapper;
+
+    @Autowired
+    private ProductInventoryMapper productInventoryMapper;
+
+    @Autowired
+    private ProductCodeListMapper productCodeListMapper;
+
+    @Autowired
+    private ProductWarehousingRecordMapper productWarehousingRecordMapper;
+
+    /**
+     * 查询物料流转-新
+     * 
+     * @param id 物料流转-新主键
+     * @return 物料流转-新
+     */
+    @Override
+    public MaterialFlow selectMaterialFlowById(Long id)
+    {
+        return materialFlowMapper.selectMaterialFlowById(id);
+    }
+
+    /**
+     * 查询物料流转-新列表
+     * 
+     * @param materialFlow 物料流转-新
+     * @return 物料流转-新
+     */
+    @Override
+    public List<MaterialFlow> selectMaterialFlowList(MaterialFlow materialFlow)
+    {
+        return materialFlowMapper.selectMaterialFlowList(materialFlow);
+    }
+
+    /**
+     * 新增物料流转-新
+     * 
+     * @param materialFlowList 物料流转-新
+     * @return 结果
+     */
+    @Override
+    @Transactional
+    public AjaxResult insertMaterialFlow(List<MaterialFlow> materialFlowList)
+    {
+        //根据码单号查询当前库存信息,判断重量是否足够
+        for (MaterialFlow materialFlow : materialFlowList){
+
+            ProductWarehousingRecord productWarehousingRecord1 =
+                    productWarehousingRecordMapper.selectProductWarehousingRecordWhetherExist(materialFlow.getQrCode(), materialFlow.getQrCodeId());
+
+            //得到当前库存
+            ProductInventory productInventory = productInventoryMapper.selectProductInventoryByQrCode(materialFlow.getQrCode());
+
+            ProductInventory editProductInventory = new ProductInventory();
+            editProductInventory.setId(productInventory.getId());
+            //筒数
+            if(productInventory.getTotalCanisterNum() - productWarehousingRecord1.getCanisterNum() < 0){
+                return AjaxResult.error("当前库存筒数不足");
+            }else {
+                editProductInventory.setTotalCanisterNum(productInventory.getTotalCanisterNum() - productWarehousingRecord1.getCanisterNum());
+            }
+            //箱数
+            if(productInventory.getTotalBoxNum() - 1 < 0){
+                return AjaxResult.error("当前库存箱数不足");
+            }else {
+                editProductInventory.setTotalBoxNum(productInventory.getTotalBoxNum() - 1);
+            }
+            //净重
+            if(productInventory.getTotalSuttle() - productWarehousingRecord1.getSuttle() < 0){
+                return AjaxResult.error("当前库存净重不足");
+            }else {
+                editProductInventory.setTotalSuttle(handlingWeight(productInventory.getTotalSuttle() - productWarehousingRecord1.getSuttle()));
+            }
+            //毛重
+            if (productInventory.getTotalGrossWeight() - productWarehousingRecord1.getGrossWeight() < 0){
+                return AjaxResult.error("当前库存毛重不足");
+            }else {
+                editProductInventory.setTotalGrossWeight(handlingWeight(productInventory.getTotalGrossWeight() - productWarehousingRecord1.getGrossWeight()));
+            }
+            productInventoryMapper.updateProductInventory(editProductInventory);
+
+            //查询当前码单是否已经流转,已流转跳过本次循环
+            MaterialFlow materialFlow1 = new MaterialFlow();
+            materialFlow1.setQrCode(materialFlow.getQrCode());
+            materialFlow1.setQrCodeId(materialFlow.getQrCodeId());
+            if (materialFlowMapper.selectMaterialFlowList(materialFlow1).size() > 0){
+                continue;
+            }
+
+            //新增物料流转记录
+            materialFlow.setCreateTime(DateUtils.getNowDate());
+            materialFlow.setCreateBy(SecurityUtils.getUsername());
+            materialFlow.setCreateById(SecurityUtils.getUserId());
+            materialFlowMapper.insertMaterialFlow(materialFlow);
+        }
+
+
+        return AjaxResult.success();
+
+
+//
+    }
+
+    //保留两位小数
+    public Double handlingWeight(Double weight){
+        DecimalFormat df = new DecimalFormat("0.00");
+        return Double.parseDouble(df.format(weight));
+    }
+
+    /**
+     * 修改物料流转-新
+     * 
+     * @param materialFlow 物料流转-新
+     * @return 结果
+     */
+    @Override
+    public int updateMaterialFlow(MaterialFlow materialFlow)
+    {
+        materialFlow.setUpdateTime(DateUtils.getNowDate());
+        return materialFlowMapper.updateMaterialFlow(materialFlow);
+    }
+
+    /**
+     * 批量删除物料流转-新
+     * 
+     * @param ids 需要删除的物料流转-新主键
+     * @return 结果
+     */
+    @Override
+    public int deleteMaterialFlowByIds(Long[] ids)
+    {
+        return materialFlowMapper.deleteMaterialFlowByIds(ids);
+    }
+
+    /**
+     * 删除物料流转-新信息
+     * 
+     * @param id 物料流转-新主键
+     * @return 结果
+     */
+    @Override
+    public int deleteMaterialFlowById(Long id)
+    {
+        return materialFlowMapper.deleteMaterialFlowById(id);
+    }
+}

+ 6 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/service/impl/MaterielServiceImpl.java

@@ -98,4 +98,10 @@ public class MaterielServiceImpl implements IMaterielService
     {
         return materielMapper.deleteMaterielById(id);
     }
+
+    @Override
+    public List<Materiel> queryMaterielList() {
+        return materielMapper.queryMaterielList();
+    }
+
 }

+ 35 - 33
zkqy-custom-business/src/main/java/com/zkqy/business/service/impl/ProductCodeListServiceImpl.java

@@ -82,46 +82,38 @@ public class ProductCodeListServiceImpl implements IProductCodeListService
     public Long insertProductCodeList(ProductCodeListVO vo)
     {
         System.err.println(vo.getId());
-        if(vo.getId() == null){
+//        if(vo.getId() == null){
             //新增产品码单数据
             ProductCodeList productCodeList = new ProductCodeList();
             BeanUtils.copyProperties(vo,productCodeList);
             productCodeList.setCreateTime(DateUtils.getNowDate());
             productCodeList.setCreateBy(SecurityUtils.getUsername());
             productCodeList.setCreateById(SecurityUtils.getUserId());
-            productCodeList.setTotalBoxNum(1);
-            productCodeList.setTotalCanisterNum(vo.getCanisterNum());
-            productCodeList.setTotalSuttle(vo.getSuttle());
-            productCodeList.setTotalGrossWeight(vo.getGrossWeight());
+//            productCodeList.setTotalBoxNum(1);
+//            productCodeList.setTotalCanisterNum(vo.getCanisterNum());
+//            productCodeList.setTotalSuttle(vo.getSuttle());
+//            productCodeList.setTotalGrossWeight(vo.getGrossWeight());
             productCodeListMapper.insertProductCodeList(productCodeList);
-            //新增产品码单详情
-//        vo.getProductCodeListInfoList().forEach(productCodeListInfo -> {
-//            productCodeListInfo.setCodeListId(productCodeList.getId());
-//            productCodeListInfo.setCreateTime(DateUtils.getNowDate());
-//            productCodeListInfo.setCreateBy(SecurityUtils.getUsername());
-//            productCodeListInfo.setCreateById(SecurityUtils.getUserId());
-//        });
-//        productCodeListInfoMapper.insertProductCodeListInfo(vo.getProductCodeListInfoList());
             return productCodeList.getId();
-        }else {
-            //计算合计箱数、筒数、净重、毛重
-            ProductCodeList productCodeList = productCodeListMapper.selectProductCodeListById(vo.getId());
-            ProductCodeList editProductCodeList = new ProductCodeList();
-            editProductCodeList.setId(productCodeList.getId());
-
-            editProductCodeList.setTotalBoxNum(productCodeList.getTotalBoxNum() == null ? 1 : productCodeList.getTotalBoxNum() + 1);//箱数
-            editProductCodeList.setTotalCanisterNum(productCodeList.getTotalCanisterNum() == null ? vo.getCanisterNum() : productCodeList.getTotalCanisterNum() + vo.getCanisterNum());//筒数
-            Double suttle = productCodeList.getTotalSuttle() == null ? vo.getSuttle() : productCodeList.getTotalSuttle() + vo.getSuttle();
-            DecimalFormat df = new DecimalFormat("0.00");
-            String suttle1 = df.format(suttle);
-            editProductCodeList.setTotalSuttle(Double.parseDouble(suttle1));//净重
-            Double grossWeight = productCodeList.getTotalGrossWeight() == null ? vo.getGrossWeight() : productCodeList.getTotalGrossWeight() + vo.getGrossWeight();
-            String grossWeight1 = df.format(grossWeight);
-            editProductCodeList.setTotalGrossWeight(Double.parseDouble(grossWeight1));//毛重
-            productCodeListMapper.updateProductCodeList(editProductCodeList);
-
-            return vo.getId();
-        }
+//        }else {
+//            //计算合计箱数、筒数、净重、毛重
+//            ProductCodeList productCodeList = productCodeListMapper.selectProductCodeListById(vo.getId());
+//            ProductCodeList editProductCodeList = new ProductCodeList();
+//            editProductCodeList.setId(productCodeList.getId());
+//
+//            editProductCodeList.setTotalBoxNum(productCodeList.getTotalBoxNum() == null ? 1 : productCodeList.getTotalBoxNum() + 1);//箱数
+//            editProductCodeList.setTotalCanisterNum(productCodeList.getTotalCanisterNum() == null ? vo.getCanisterNum() : productCodeList.getTotalCanisterNum() + vo.getCanisterNum());//筒数
+//            Double suttle = productCodeList.getTotalSuttle() == null ? vo.getSuttle() : productCodeList.getTotalSuttle() + vo.getSuttle();
+//            DecimalFormat df = new DecimalFormat("0.00");
+//            String suttle1 = df.format(suttle);
+//            editProductCodeList.setTotalSuttle(Double.parseDouble(suttle1));//净重
+//            Double grossWeight = productCodeList.getTotalGrossWeight() == null ? vo.getGrossWeight() : productCodeList.getTotalGrossWeight() + vo.getGrossWeight();
+//            String grossWeight1 = df.format(grossWeight);
+//            editProductCodeList.setTotalGrossWeight(Double.parseDouble(grossWeight1));//毛重
+//            productCodeListMapper.updateProductCodeList(editProductCodeList);
+//
+//            return vo.getId();
+//        }
     }
 
     /**
@@ -188,7 +180,7 @@ public class ProductCodeListServiceImpl implements IProductCodeListService
      * @return 结果
      */
     @Override
-    public int deleteProductCodeListByIds(Long[] ids)
+    public int deleteProductCodeListByIds(String[] ids)
     {
         return productCodeListMapper.deleteProductCodeListByIds(ids);
     }
@@ -222,4 +214,14 @@ public class ProductCodeListServiceImpl implements IProductCodeListService
         return nowCodeList;
     }
 
+    @Override
+    public List<ProductCodeList> selectProductCodeListByQrCode(String qrCode) {
+        return productCodeListMapper.selectProductCodeListByQrCode(qrCode);
+    }
+
+    @Override
+    public ProductCodeListVO getProductCodeListById(Long id) {
+        return productCodeListMapper.getProductCodeListById(id);
+    }
+
 }

+ 3 - 3
zkqy-custom-business/src/main/resources/mapper/MaterialCirculationMapper.xml

@@ -155,9 +155,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <select id="selectHandheldMaterialCirculationList" resultType="com.zkqy.business.domain.MaterialCirculation">
         SELECT
             mc.id,
-            m.materiel_name AS goodsname,
+            m.product_name AS goodsname,
             mc.goodsnum,
-            m.specification_model AS specifications,
+            m.product_specifications AS specifications,
             mc.weight,
             mc.receiving_process,
             mc.approval_status,
@@ -176,7 +176,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             mc.depositor
         FROM
             {DBNAME}.material_circulation mc
-                LEFT JOIN {DBNAME}.materiel m ON mc.goodsnum = m.materiel_code
+                LEFT JOIN {DBNAME}.production m ON mc.goodsnum = m.id
         WHERE
             mc.del_flag = '0'
           AND mc.approval_status = '2'

+ 134 - 0
zkqy-custom-business/src/main/resources/mapper/business/MaterialFlowMapper.xml

@@ -0,0 +1,134 @@
+<?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.zkqy.business.mapper.MaterialFlowMapper">
+    
+    <resultMap type="com.zkqy.business.domain.MaterialFlow" id="MaterialFlowResult">
+        <result property="id"    column="id"    />
+        <result property="qrCode"    column="qr_code"    />
+        <result property="qrCodeId"    column="qr_code_id"    />
+        <result property="lotNum"    column="lot_num"    />
+        <result property="productId"    column="product_id"    />
+        <result property="productName"    column="product_name"    />
+        <result property="productSpecifications"    column="product_specifications"    />
+        <result property="productColour"    column="product_colour"    />
+        <result property="productType"    column="product_type"    />
+        <result property="productWeight"    column="product_weight"    />
+        <result property="procedures"    column="procedures"    />
+        <result property="transferTime"    column="transfer_time"    />
+        <result property="transferPeople"    column="transfer_people"    />
+        <result property="remark"    column="remark"    />
+        <result property="createBy"    column="create_by"    />
+        <result property="createById"    column="create_by_id"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="updateBy"    column="update_by"    />
+        <result property="updateById"    column="update_by_id"    />
+        <result property="updateTime"    column="update_time"    />
+        <result property="delFlag"    column="del_flag"    />
+    </resultMap>
+
+    <sql id="selectMaterialFlowVo">
+        select id,qr_code, qr_code_id, lot_num, product_id, product_name, product_specifications, product_colour, product_type, product_weight, procedures, transfer_time, transfer_people, remark, create_by, create_by_id, create_time, update_by, update_by_id, update_time, del_flag from {DBNAME}.material_flow
+    </sql>
+
+    <select id="selectMaterialFlowList" parameterType="com.zkqy.business.domain.MaterialFlow" resultMap="MaterialFlowResult">
+        <include refid="selectMaterialFlowVo"/>
+        where del_flag = '0'
+            <if test="qrCode != null  and qrCode != ''"> and qr_code = #{qrCode}</if>
+            <if test="qrCodeId != null  and qrCodeId != ''"> and qr_code_id = #{qrCodeId}</if>
+            <if test="lotNum != null  and lotNum != ''"> and lot_num = #{lotNum}</if>
+            <if test="productId != null "> and product_id = #{productId}</if>
+            <if test="productName != null  and productName != ''"> and product_name like concat('%', #{productName}, '%')</if>
+            <if test="productSpecifications != null  and productSpecifications != ''"> and product_specifications = #{productSpecifications}</if>
+            <if test="productColour != null  and productColour != ''"> and product_colour = #{productColour}</if>
+            <if test="productType != null  and productType != ''"> and product_type = #{productType}</if>
+            <if test="productWeight != null "> and product_weight = #{productWeight}</if>
+            <if test="procedures != null  and procedures != ''"> and procedures = #{procedures}</if>
+            <if test="transferTime != null "> and transfer_time = #{transferTime}</if>
+            <if test="transferPeople != null  and transferPeople != ''"> and transfer_people = #{transferPeople}</if>
+    </select>
+    
+    <select id="selectMaterialFlowById" parameterType="Long" resultMap="MaterialFlowResult">
+        <include refid="selectMaterialFlowVo"/>
+        where id = #{id}
+    </select>
+        
+    <insert id="insertMaterialFlow" parameterType="com.zkqy.business.domain.MaterialFlow" useGeneratedKeys="true" keyProperty="id">
+        insert into {DBNAME}.material_flow
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="qrCode != null">qr_code,</if>
+            <if test="qrCodeId != null">qr_code_id,</if>
+            <if test="lotNum != null">lot_num,</if>
+            <if test="productId != null">product_id,</if>
+            <if test="productName != null">product_name,</if>
+            <if test="productSpecifications != null">product_specifications,</if>
+            <if test="productColour != null">product_colour,</if>
+            <if test="productType != null">product_type,</if>
+            <if test="productWeight != null">product_weight,</if>
+            <if test="procedures != null">procedures,</if>
+            <if test="transferTime != null">transfer_time,</if>
+            <if test="transferPeople != null">transfer_people,</if>
+            <if test="remark != null">remark,</if>
+            <if test="createBy != null">create_by,</if>
+            <if test="createById != null">create_by_id,</if>
+            <if test="createTime != null">create_time,</if>
+            del_flag
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="qrCode != null">#{qrCode},</if>
+            <if test="qrCodeId != null">#{qrCodeId},</if>
+            <if test="lotNum != null">#{lotNum},</if>
+            <if test="productId != null">#{productId},</if>
+            <if test="productName != null">#{productName},</if>
+            <if test="productSpecifications != null">#{productSpecifications},</if>
+            <if test="productColour != null">#{productColour},</if>
+            <if test="productType != null">#{productType},</if>
+            <if test="productWeight != null">#{productWeight},</if>
+            <if test="procedures != null">#{procedures},</if>
+            <if test="transferTime != null">#{transferTime},</if>
+            <if test="transferPeople != null">#{transferPeople},</if>
+            <if test="remark != null">#{remark},</if>
+            <if test="createBy != null">#{createBy},</if>
+            <if test="createById != null">#{createById},</if>
+            <if test="createTime != null">#{createTime},</if>
+            '0'
+         </trim>
+    </insert>
+
+    <update id="updateMaterialFlow" parameterType="com.zkqy.business.domain.MaterialFlow">
+        update material_flow
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="lotNum != null">lot_num = #{lotNum},</if>
+            <if test="productId != null">product_id = #{productId},</if>
+            <if test="productName != null">product_name = #{productName},</if>
+            <if test="productSpecifications != null">product_specifications = #{productSpecifications},</if>
+            <if test="productColour != null">product_colour = #{productColour},</if>
+            <if test="productType != null">product_type = #{productType},</if>
+            <if test="productWeight != null">product_weight = #{productWeight},</if>
+            <if test="procedures != null">procedures = #{procedures},</if>
+            <if test="transferTime != null">transfer_time = #{transferTime},</if>
+            <if test="transferPeople != null">transfer_people = #{transferPeople},</if>
+            <if test="remark != null">remark = #{remark},</if>
+            <if test="createBy != null">create_by = #{createBy},</if>
+            <if test="createById != null">create_by_id = #{createById},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="updateBy != null">update_by = #{updateBy},</if>
+            <if test="updateById != null">update_by_id = #{updateById},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+            <if test="delFlag != null">del_flag = #{delFlag},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteMaterialFlowById" parameterType="Long">
+        delete from material_flow where id = #{id}
+    </delete>
+
+    <delete id="deleteMaterialFlowByIds" parameterType="String">
+        delete from material_flow where id in 
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>

+ 5 - 0
zkqy-custom-business/src/main/resources/mapper/business/MaterielMapper.xml

@@ -157,4 +157,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             #{id}
         </foreach>
     </delete>
+
+    <select id="queryMaterielList" resultMap="MaterielResult">
+        <include refid="selectMaterielVo"/>
+        where del_flag = '0' and materiel_species = '1' order by materiel_name desc
+    </select>
 </mapper>

+ 35 - 8
zkqy-custom-business/src/main/resources/mapper/business/ProductCodeListMapper.xml

@@ -77,6 +77,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="productName"    column="product_name"    />
         <result property="productColor" column="product_color"/>
         <result property="productSpecifications" column="product_specifications"/>
+        <result property="productType" column="product_type"/>
         <result property="totalCanisterNum" column="total_canister_num"/>
         <result property="totalBoxNum" column="total_box_num"/>
         <result property="totalSuttle" column="total_suttle"/>
@@ -90,14 +91,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectProductCodeListList" parameterType="com.zkqy.business.domain.vo.ProductCodeListVO" resultMap="ProductCodeListResultVO">
         SELECT
-            pcl.* ,
-            p.product_name as product_name,
-            p.product_specifications as product_specifications,
-            pcl.product_colour as product_color
-        FROM
+            pcl.id,
+            pcl.qr_code,
+            p.product_name AS product_name,
+            p.product_specifications AS product_specifications,
+            pcl.lot_num,
+            pcl.product_colour AS product_color,
+            pcl.levels,
+            sum( pcl.canister_num ) AS total_canister_num,
+            count( pcl.box_num ) AS total_box_num,
+            sum( pcl.suttle ) AS total_suttle,
+            sum( pcl.gross_weight ) AS total_gross_weight,
+            pcl.remark
+            FROM
             {DBNAME}.product_code_list pcl
-        LEFT JOIN {DBNAME}.production p ON pcl.product_id = p.id
-        WHERE
+            LEFT JOIN {DBNAME}.production p ON pcl.product_id = p.id
+            WHERE
             pcl.del_flag = '0'
             AND p.del_flag = '0'
             <if test="qrCode != null  and qrCode != ''"> and pcl.qr_code = #{qrCode}</if>
@@ -105,6 +114,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="productName != null and productName != ''"> and p.product_name = #{productName}</if>
             <if test="productSpecifications != null and productSpecifications != ''"> and p.product_specifications = #{productSpecifications}</if>
             <if test="productColor != null and productColor != ''"> and pcl.product_colour = #{productColor}</if>
+            GROUP BY
+            pcl.qr_code
+            order by pcl.id desc
     </select>
     
     <select id="selectProductCodeListById" parameterType="Long" resultMap="ProductCodeListResult">
@@ -224,7 +236,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </delete>
 
     <update id="deleteProductCodeListByIds" parameterType="String">
-        update {DBNAME}.product_code_list set del_flag = '2' where id in
+        update {DBNAME}.product_code_list set del_flag = '2' where qr_code in
         <foreach item="id" collection="array" open="(" separator="," close=")">
             #{id}
         </foreach>
@@ -232,6 +244,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="selectFinishedProduct" resultType="com.zkqy.business.domain.vo.ProductCodeListVO">
         SELECT
+            sp.id as id,
             sp.lot_number AS lotNum,
             p.product_name AS productName,
             p.product_specifications AS productSpecifications,
@@ -254,4 +267,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         select IFNULL(max(qr_code),0) from {DBNAME}.product_code_list where del_flag = '0'
     </select>
 
+    <select id="selectProductCodeListByQrCode" parameterType="string" resultMap="ProductCodeListResult">
+        <include refid="selectProductCodeListVo"/>
+        where qr_code = #{qrCode} and del_flag = '0'
+    </select>
+
+    <select id="getProductCodeListById" resultMap="ProductCodeListResultVO">
+        SELECT
+            *
+        FROM
+            {DBNAME}.product_code_list pcl
+                LEFT JOIN {DBNAME}.production p ON pcl.product_id = p.id
+        where pcl.del_flag = '0' and p.del_flag = '0' and pcl.id = #{id}
+    </select>
+
 </mapper>