hmc 1 жил өмнө
parent
commit
8f8d0e3d86

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

@@ -43,6 +43,17 @@ public class MaterielController extends BaseController
         return getDataTable(list);
     }
 
+    @PreAuthorize("@ss.hasPermi('system:materiel:list')")
+    @GetMapping("/getList")
+    @ApiOperation(value = "查询物料信息列表")
+    public AjaxResult getList(Materiel materiel)
+    {
+        startPage();
+        List<Materiel> list = materielService.selectMaterielList(materiel);
+        return AjaxResult.success(list);
+    }
+
+
     @PreAuthorize("@ss.hasPermi('system:materiel:list')")
     @GetMapping("/getMaterielInfo")
     @ApiOperation(value = "查询物料信息列表")

+ 45 - 34
zkqy-custom-business/src/main/java/com/zkqy/business/controller/PurchaseController.java

@@ -2,18 +2,13 @@ package com.zkqy.business.controller;
 
 import java.util.List;
 import javax.servlet.http.HttpServletResponse;
+
+import com.zkqy.business.domain.vo.PurchaseVo;
 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 org.springframework.web.bind.annotation.*;
 import com.zkqy.common.annotation.Log;
 import com.zkqy.common.core.controller.BaseController;
 import com.zkqy.common.core.domain.AjaxResult;
@@ -27,24 +22,22 @@ import com.zkqy.common.core.page.TableDataInfo;
  * 采购Controller
  *
  * @author zkqy
- * @date 2024-04-12
+ * @date 2024-04-12 /business/purchase//list/updatePurchase
  */
 @RestController
-@RequestMapping("/business/采购表")
+@RequestMapping("/business/purchase")
 @Api(value = "/business/采购表", description = "采购-接口")
-public class PurchaseController extends BaseController
-{
+public class PurchaseController extends BaseController {
     @Autowired
     private IPurchaseService purchaseService;
 
-/**
- * 查询采购列表
- */
-@PreAuthorize("@ss.hasPermi('business:采购表:list')")
-@GetMapping("/list")
-@ApiOperation(value = "查询采购列表")
-    public TableDataInfo list(Purchase purchase)
-    {
+    /**
+     * 查询采购列表
+     */
+    @PreAuthorize("@ss.hasPermi('business:采购表:list')")
+    @GetMapping("/list")
+    @ApiOperation(value = "查询采购列表")
+    public TableDataInfo list(Purchase purchase) {
         startPage();
         List<Purchase> list = purchaseService.selectPurchaseList(purchase);
         return getDataTable(list);
@@ -57,8 +50,7 @@ public class PurchaseController extends BaseController
     @Log(title = "采购", businessType = BusinessType.EXPORT)
     @PostMapping("/export")
     @ApiOperation(value = "导出采购列表")
-    public void export(HttpServletResponse response, Purchase purchase)
-    {
+    public void export(HttpServletResponse response, Purchase purchase) {
         List<Purchase> list = purchaseService.selectPurchaseList(purchase);
         ExcelUtil<Purchase> util = new ExcelUtil<Purchase>(Purchase.class);
         util.exportExcel(response, list, "采购数据");
@@ -70,8 +62,7 @@ public class PurchaseController extends BaseController
     @PreAuthorize("@ss.hasPermi('business:采购表:query')")
     @GetMapping(value = "/{id}")
     @ApiOperation(value = "获取采购详细信息")
-    public AjaxResult getInfo(@PathVariable("id") String id)
-    {
+    public AjaxResult getInfo(@PathVariable("id") String id) {
         return success(purchaseService.selectPurchaseById(id));
     }
 
@@ -82,23 +73,44 @@ public class PurchaseController extends BaseController
     @Log(title = "采购", businessType = BusinessType.INSERT)
     @PostMapping
     @ApiOperation(value = "新增采购")
-    public AjaxResult add(@RequestBody Purchase purchase)
-    {
-        return toAjax(purchaseService.insertPurchase(purchase));
+    public AjaxResult add(@RequestBody PurchaseVo purchaseVo) {
+        return toAjax(purchaseService.insertPurchase(purchaseVo));
+    }
+
+    /**
+     * 修改前先查询采购单1
+     */
+    @PreAuthorize("@ss.hasPermi('business:采购表:edit')")
+    @Log(title = "采购", businessType = BusinessType.UPDATE)
+    @GetMapping("list/getInfoEdit")
+    @ApiOperation(value = "修改采购")
+    public AjaxResult infoEdit(@RequestParam("id")String  id) {
+        return AjaxResult.success(purchaseService.selectPurchaseInfoById(id));
     }
 
+
+    /**
+     * 修改前先查询采购单2
+     */
+    @PreAuthorize("@ss.hasPermi('business:采购表:edit')")
+    @Log(title = "采购", businessType = BusinessType.UPDATE)
+    @GetMapping("list/getInfoEditPurchaseId")
+    @ApiOperation(value = "修改采购")
+    public AjaxResult getInfoEditPurchaseId(@RequestParam("PurchaseId")String  PurchaseId) {
+        return AjaxResult.success(purchaseService.getInfoEditPurchaseId(PurchaseId));
+    }
     /**
-     * 修改采购
+     * 修改采购信息
      */
     @PreAuthorize("@ss.hasPermi('business:采购表:edit')")
     @Log(title = "采购", businessType = BusinessType.UPDATE)
-    @PutMapping
+    @PostMapping("/list/updatePurchase")
     @ApiOperation(value = "修改采购")
-    public AjaxResult edit(@RequestBody Purchase purchase)
-    {
-        return toAjax(purchaseService.updatePurchase(purchase));
+    public AjaxResult updatePurchase(@RequestBody PurchaseVo purchaseVo) {
+        return AjaxResult.success(purchaseService.updatePurchaseInfo(purchaseVo));
     }
 
+
     /**
      * 删除采购
      */
@@ -106,8 +118,7 @@ public class PurchaseController extends BaseController
     @Log(title = "采购", businessType = BusinessType.DELETE)
     @DeleteMapping("/{ids}")
     @ApiOperation(value = "删除采购")
-    public AjaxResult remove(@PathVariable String[] ids)
-    {
+    public AjaxResult remove(@PathVariable String[] ids) {
         return toAjax(purchaseService.deletePurchaseByIds(ids));
     }
 }

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

@@ -121,7 +121,7 @@ public class PurchaseInfoController extends BaseController
     @Log(title = "采购详情", businessType = BusinessType.DELETE)
     @DeleteMapping("/{ids}")
     @ApiOperation(value = "删除采购详情")
-    public AjaxResult remove(@PathVariable Long[] ids)
+    public AjaxResult remove(@PathVariable List<Long> ids)
     {
         return toAjax(purchaseInfoService.deletePurchaseInfoByIds(ids));
     }

+ 15 - 1
zkqy-custom-business/src/main/java/com/zkqy/business/mapper/PurchaseInfoMapper.java

@@ -54,6 +54,13 @@ public interface PurchaseInfoMapper
      */
     public int updatePurchaseInfo(PurchaseInfo purchaseInfo);
 
+    /**
+     * 批量修改
+     * @param purchaseInfo
+     * @return
+     */
+    public int updatePurchaseInfoByPurchaseId(PurchaseInfo purchaseInfo);
+
     /**
      * 删除采购详情
      * 
@@ -68,5 +75,12 @@ public interface PurchaseInfoMapper
      * @param ids 需要删除的数据主键集合
      * @return 结果
      */
-    public int deletePurchaseInfoByIds(Long[] ids);
+    public int deletePurchaseInfoByIds(List<Long> ids);
+
+    /**
+     * 删除
+     * @param ids
+     * @return
+     */
+    public int deletePurchaseInfoByPurchaseId(List<String> ids);
 }

+ 9 - 0
zkqy-custom-business/src/main/java/com/zkqy/business/mapper/PurchaseMapper.java

@@ -21,6 +21,15 @@ public interface PurchaseMapper
      */
     public Purchase selectPurchaseById(String id);
 
+
+    /**
+     * 查询采购
+     *
+     * @param serialumber 采购主键
+     * @return 采购
+     */
+    public Purchase selectPurchaseBySerialumber(String serialumber);
+
     /**
      * 查询采购列表
      * 

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

@@ -59,7 +59,7 @@ public interface IPurchaseInfoService
      * @param ids 需要删除的采购详情主键集合
      * @return 结果
      */
-    public int deletePurchaseInfoByIds(Long[] ids);
+    public int deletePurchaseInfoByIds(List<Long> ids);
 
     /**
      * 删除采购详情信息

+ 18 - 1
zkqy-custom-business/src/main/java/com/zkqy/business/service/IPurchaseService.java

@@ -2,6 +2,7 @@ package com.zkqy.business.service;
 
 import java.util.List;
 import com.zkqy.business.domain.Purchase;
+import com.zkqy.business.domain.vo.PurchaseVo;
 
 /**
  * 采购Service接口
@@ -33,7 +34,7 @@ public interface IPurchaseService
      * @param purchase 采购
      * @return 结果
      */
-    public int insertPurchase(Purchase purchase);
+    public int insertPurchase(PurchaseVo purchase);
 
     /**
      * 修改采购
@@ -58,4 +59,20 @@ public interface IPurchaseService
      * @return 结果
      */
     public int deletePurchaseById(String id);
+
+    /**
+     * 通过id得到采购单信息
+     * @param id
+     * @return
+     */
+    public PurchaseVo selectPurchaseInfoById(String id);
+
+    int  updatePurchaseInfo(PurchaseVo purchaseVo);
+
+    /**
+     * 获取表格信息
+     * @param purchaseId
+     * @return
+     */
+    PurchaseVo getInfoEditPurchaseId(String purchaseId);
 }

+ 1 - 1
zkqy-custom-business/src/main/java/com/zkqy/business/service/impl/PurchaseInfoServiceImpl.java

@@ -90,7 +90,7 @@ public class PurchaseInfoServiceImpl implements IPurchaseInfoService
      * @return 结果
      */
     @Override
-    public int deletePurchaseInfoByIds(Long[] ids)
+    public int deletePurchaseInfoByIds(List<Long> ids)
     {
         return purchaseInfoMapper.deletePurchaseInfoByIds(ids);
     }

+ 79 - 9
zkqy-custom-business/src/main/java/com/zkqy/business/service/impl/PurchaseServiceImpl.java

@@ -1,12 +1,22 @@
 package com.zkqy.business.service.impl;
 
+import java.util.ArrayList;
 import java.util.List;
+import java.util.stream.Collectors;
+
+import com.zkqy.business.domain.PurchaseInfo;
+import com.zkqy.business.domain.vo.PurchaseVo;
+import com.zkqy.business.mapper.PurchaseInfoMapper;
 import com.zkqy.common.utils.DateUtils;
+import com.zkqy.common.utils.SecurityUtils;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.core.SpringSecurityCoreVersion;
 import org.springframework.stereotype.Service;
 import com.zkqy.business.mapper.PurchaseMapper;
 import com.zkqy.business.domain.Purchase;
 import com.zkqy.business.service.IPurchaseService;
+import org.springframework.transaction.annotation.Transactional;
 
 /**
  * 采购Service业务层处理
@@ -15,15 +25,18 @@ import com.zkqy.business.service.IPurchaseService;
  * @date 2024-04-12
  */
 @Service
-public class PurchaseServiceImpl implements IPurchaseService 
+public class PurchaseServiceImpl implements IPurchaseService
 {
 
     @Autowired
     private PurchaseMapper purchaseMapper;
 
+    @Autowired
+    private PurchaseInfoMapper  purchaseInfoMapper;
+
     /**
      * 查询采购
-     * 
+     *
      * @param id 采购主键
      * @return 采购
      */
@@ -35,7 +48,7 @@ public class PurchaseServiceImpl implements IPurchaseService
 
     /**
      * 查询采购列表
-     * 
+     *
      * @param purchase 采购
      * @return 采购
      */
@@ -47,20 +60,34 @@ public class PurchaseServiceImpl implements IPurchaseService
 
     /**
      * 新增采购
-     * 
+     *
      * @param purchase 采购
      * @return 结果
      */
     @Override
-    public int insertPurchase(Purchase purchase)
+    @Transactional
+    public int insertPurchase(PurchaseVo purchase)
     {
         purchase.setCreateTime(DateUtils.getNowDate());
-        return purchaseMapper.insertPurchase(purchase);
+        purchase.setCreateById(SecurityUtils.getUserId());
+        purchase.setCreateBy(SecurityUtils.getUsername());
+        purchase.setDataApprovalStatus("0");
+        purchase.setDelFlag("0");
+        purchaseMapper.insertPurchase(purchase);
+        if(purchase.getPurchaseInfos().size()>0){
+              purchase.getPurchaseInfos().forEach(item->{
+                  item.setLotNumber(purchase.getLotNumber());
+                  item.setPurchaseId(purchase.getId());//新增数据回填
+                  item.setDelFlag("0");
+                  purchaseInfoMapper.insertPurchaseInfo(item);
+              });
+        }
+      return 1;
     }
 
     /**
      * 修改采购
-     * 
+     *
      * @param purchase 采购
      * @return 结果
      */
@@ -73,7 +100,7 @@ public class PurchaseServiceImpl implements IPurchaseService
 
     /**
      * 批量删除采购
-     * 
+     *
      * @param ids 需要删除的采购主键
      * @return 结果
      */
@@ -85,7 +112,7 @@ public class PurchaseServiceImpl implements IPurchaseService
 
     /**
      * 删除采购信息
-     * 
+     *
      * @param id 采购主键
      * @return 结果
      */
@@ -94,4 +121,47 @@ public class PurchaseServiceImpl implements IPurchaseService
     {
         return purchaseMapper.deletePurchaseById(id);
     }
+
+    @Override
+    public PurchaseVo selectPurchaseInfoById(String id) {
+        Purchase purchase = purchaseMapper.selectPurchaseById(id);
+        PurchaseVo purchaseVo = new PurchaseVo();
+        BeanUtils.copyProperties(purchase,purchaseVo);
+        PurchaseInfo purchaseInfo=new PurchaseInfo();
+        purchaseInfo.setPurchaseId(id);
+        List<PurchaseInfo> purchaseInfos = purchaseInfoMapper.selectPurchaseInfoList(purchaseInfo);
+        purchaseVo.setPurchaseInfos(purchaseInfos);
+        return purchaseVo;
+    }
+
+    @Override
+    public int updatePurchaseInfo(PurchaseVo purchaseVo) {
+        int i = purchaseMapper.updatePurchase(purchaseVo);
+        if(i>0){
+            List<String> strings=new ArrayList<>();
+            strings.add(purchaseVo.getSerialNumber());
+            //批量删除
+            int i1 = purchaseInfoMapper.deletePurchaseInfoByPurchaseId(strings);//            purchaseVo.getPurchaseInfos().forEach(item->{
+                //重新插入
+                purchaseVo.getPurchaseInfos().forEach(item->{
+                    item.setLotNumber(purchaseVo.getLotNumber());
+                    item.setPurchaseId(purchaseVo.getSerialNumber());//新增数据回填
+                    item.setDelFlag("0");
+                    purchaseInfoMapper.insertPurchaseInfo(item);
+                });
+        }
+        return 1;
+    }
+
+    @Override
+    public PurchaseVo getInfoEditPurchaseId(String purchaseId) {
+        Purchase purchase = purchaseMapper.selectPurchaseBySerialumber(purchaseId);
+        PurchaseVo purchaseVo = new PurchaseVo();
+        BeanUtils.copyProperties(purchase,purchaseVo);
+        PurchaseInfo purchaseInfo=new PurchaseInfo();
+        purchaseInfo.setPurchaseId(purchaseId);
+        List<PurchaseInfo> purchaseInfos = purchaseInfoMapper.selectPurchaseInfoList(purchaseInfo);
+        purchaseVo.setPurchaseInfos(purchaseInfos);
+        return purchaseVo;
+    }
 }

+ 40 - 6
zkqy-custom-business/src/main/resources/mapper/business/PurchaseInfoMapper.xml

@@ -42,7 +42,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
 
     <sql id="selectPurchaseInfoVo">
-        select id, purchase_id, supplier_no, materiel_id, units, specification, quantity, unit_price, amount, remark, create_by_id, create_by, create_time, update_by_id, update_by, update_time, del_flag, task_process_key, task_node_key, lot_number from purchase_info
+        select id, purchase_id, supplier_no, materiel_id, units, specification, quantity, unit_price, amount, remark, create_by_id, create_by, create_time, update_by_id, update_by, update_time, del_flag, task_process_key, task_node_key, lot_number from {DBNAME}.purchase_info
     </sql>
 
     <select id="selectPurchaseInfoList" parameterType="com.zkqy.business.domain.PurchaseInfo" resultMap="PurchaseInfoResult">
@@ -61,6 +61,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="taskProcessKey != null  and taskProcessKey != ''"> and task_process_key = #{taskProcessKey}</if>
             <if test="taskNodeKey != null  and taskNodeKey != ''"> and task_node_key = #{taskNodeKey}</if>
             <if test="lotNumber != null  and lotNumber != ''"> and lot_number = #{lotNumber}</if>
+            and del_flag!=2
         </where>
     </select>
     
@@ -92,7 +93,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </select>
 
     <insert id="insertPurchaseInfo" parameterType="com.zkqy.business.domain.PurchaseInfo" useGeneratedKeys="true" keyProperty="id">
-        insert into purchase_info
+        insert into {DBNAME}.purchase_info
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="purchaseId != null">purchase_id,</if>
             <if test="supplierNo != null">supplier_no,</if>
@@ -138,7 +139,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </insert>
 
     <update id="updatePurchaseInfo" parameterType="com.zkqy.business.domain.PurchaseInfo">
-        update purchase_info
+        update {DBNAME}.purchase_info
         <trim prefix="SET" suffixOverrides=",">
             <if test="purchaseId != null">purchase_id = #{purchaseId},</if>
             <if test="supplierNo != null">supplier_no = #{supplierNo},</if>
@@ -163,13 +164,46 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         where id = #{id}
     </update>
 
+    <update id="updatePurchaseInfoByPurchaseId" parameterType="com.zkqy.business.domain.PurchaseInfo">
+        update {DBNAME}.purchase_info
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="purchaseId != null">purchase_id = #{purchaseId},</if>
+            <if test="supplierNo != null">supplier_no = #{supplierNo},</if>
+            <if test="materielId != null">materiel_id = #{materielId},</if>
+            <if test="units != null">units = #{units},</if>
+            <if test="specification != null">specification = #{specification},</if>
+            <if test="quantity != null">quantity = #{quantity},</if>
+            <if test="unitPrice != null">unit_price = #{unitPrice},</if>
+            <if test="amount != null">amount = #{amount},</if>
+            <if test="remark != null">remark = #{remark},</if>
+            <if test="createById != null">create_by_id = #{createById},</if>
+            <if test="createBy != null">create_by = #{createBy},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="updateById != null">update_by_id = #{updateById},</if>
+            <if test="updateBy != null">update_by = #{updateBy},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+            <if test="delFlag != null">del_flag = #{delFlag},</if>
+            <if test="taskProcessKey != null">task_process_key = #{taskProcessKey},</if>
+            <if test="taskNodeKey != null">task_node_key = #{taskNodeKey},</if>
+            <if test="lotNumber != null">lot_number = #{lotNumber},</if>
+        </trim>
+        where purchase_id = #{purchaseId}
+    </update>
+
     <delete id="deletePurchaseInfoById" parameterType="Long">
-        delete from purchase_info where id = #{id}
+        delete from {DBNAME}.purchase_info where id = #{id}
     </delete>
 
     <delete id="deletePurchaseInfoByIds" parameterType="String">
-        delete from purchase_info where id in 
-        <foreach item="id" collection="array" open="(" separator="," close=")">
+        delete from {DBNAME}.purchase_info where id in
+        <foreach item="id" collection="list" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+
+    <delete id="deletePurchaseInfoByPurchaseId" parameterType="String">
+        delete from {DBNAME}.purchase_info where purchase_id in
+        <foreach item="id" collection="list" open="(" separator="," close=")">
             #{id}
         </foreach>
     </delete>

+ 9 - 7
zkqy-custom-business/src/main/resources/mapper/business/PurchaseMapper.xml

@@ -40,7 +40,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
 
     <sql id="selectPurchaseVo">
-        select id, serial_number, buy_name, supplier_no, use_department, use_department_id, declarant, reviewer, reviewer_state, reviewer_notes, approver, approver_state, approver_noets, materiel_id, units, specification, quantity, unit_price, amount, data_approval_status, remark, create_by_id, create_by, create_time, update_by_id, update_by, update_time, del_flag, task_process_key, task_node_key, process_key, lot_number from purchase
+        select id, serial_number, buy_name, supplier_no, use_department, use_department_id, declarant, reviewer, reviewer_state, reviewer_notes, approver, approver_state, approver_noets, materiel_id, units, specification, quantity, unit_price, amount, data_approval_status, remark, create_by_id, create_by, create_time, update_by_id, update_by, update_time, del_flag, task_process_key, task_node_key, process_key, lot_number from {DBNAME}.purchase
     </sql>
 
     <select id="selectPurchaseList" parameterType="com.zkqy.business.domain.Purchase" resultMap="PurchaseResult">
@@ -78,11 +78,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <include refid="selectPurchaseVo"/>
         where id = #{id}
     </select>
-        
-    <insert id="insertPurchase" parameterType="com.zkqy.business.domain.Purchase">
-        insert into purchase
+    <select id="selectPurchaseBySerialumber" resultType="com.zkqy.business.domain.Purchase">
+        <include refid="selectPurchaseVo"/>
+        where serial_number = #{serialNumber}
+    </select>
+
+    <insert id="insertPurchase" parameterType="com.zkqy.business.domain.Purchase" useGeneratedKeys="true" keyProperty="id">
+        insert into {DBNAME}.purchase
         <trim prefix="(" suffix=")" suffixOverrides=",">
-            <if test="id != null">id,</if>
             <if test="serialNumber != null">serial_number,</if>
             <if test="buyName != null">buy_name,</if>
             <if test="supplierNo != null">supplier_no,</if>
@@ -116,7 +119,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="lotNumber != null">lot_number,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
-            <if test="id != null">#{id},</if>
             <if test="serialNumber != null">#{serialNumber},</if>
             <if test="buyName != null">#{buyName},</if>
             <if test="supplierNo != null">#{supplierNo},</if>
@@ -152,7 +154,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </insert>
 
     <update id="updatePurchase" parameterType="com.zkqy.business.domain.Purchase">
-        update purchase
+        update {DBNAME}.purchase
         <trim prefix="SET" suffixOverrides=",">
             <if test="serialNumber != null">serial_number = #{serialNumber},</if>
             <if test="buyName != null">buy_name = #{buyName},</if>

+ 9 - 0
zkqy-process-execution/src/main/java/com/zkqy/execution/produce/utils/EchoNodeFormData.java

@@ -120,6 +120,15 @@ public class EchoNodeFormData {
         // 处理新增
         if (bpmRunNodeFormDateVo.getInsertCommonEntityList().size() != 0) {
             bpmRunNodeFormDateVo.getInsertCommonEntityList().forEach(item -> {
+//                List<Map<String, String>> addListMap = item.getAddListMap();
+//                addListMap.forEach(it->{
+//                    if(it.get("task_process_key")==null||it.get("task_process_key").equals("")){
+//                        it.remove("task_process_key");
+//                    }
+//                    if(it.get("task_node_key")==null||it.get("task_node_key").equals("")){
+//                        it.remove("task_node_key");
+//                    }
+//                });
                 iCommonService.batchInsert(item);
             });
         }

+ 265 - 21
zkqy-ui/src/views/orderMange/purchase/listInfoTwo.vue

@@ -329,6 +329,117 @@
       </span>
     </el-dialog>
 
+    <!-- 自定义新增弹窗 -->
+    <el-dialog
+      :title="insertFromTitle"
+      :visible.sync="insertFrom"
+      :before-close="insertFromClose"
+      width="800px"
+    >
+      <div style="width: 800px">
+        <el-form ref="form" :label-position="labelPosition" label-width="100px"  :model="insertFormData">
+          <el-row>
+            <el-col :span="12">
+              <el-form-item label="供应商:" prop="supplier">
+                <el-select v-model="insertFormData.supplierNo" style="width: 200px;" placeholder="请选择供应商">
+                  <el-option
+                    v-for="(option, index) in suppliers"
+                    :key="option.id"
+                    :label="option.supplierName"
+                    :value="option.supplierNo"
+                  ></el-option>
+                </el-select>
+              </el-form-item>
+            </el-col>
+            <el-col :span="12">
+              <el-form-item label="批号:" prop="lotNumber">
+                <el-input v-model="insertFormData.lotNumber" style="width: 200px;"></el-input>
+              </el-form-item>
+            </el-col>
+          </el-row>
+
+          <el-row>
+            <el-col :span="12">
+              <el-form-item label="使用部门:" prop="useDepartment">
+                <el-input v-model="insertFormData.useDepartment"  style="width: 200px;"></el-input>
+              </el-form-item>
+            </el-col>
+
+            <el-col :span="12">
+              <el-form-item label="备注:" prop="remark">
+                <el-input v-model="insertFormData.remark"  style="width: 200px;"></el-input>
+              </el-form-item>
+            </el-col>
+          </el-row>
+        </el-form>
+      </div>
+      <el-table
+        :data="insertTable"
+        style="width: 100%"
+      >
+<!--        -->
+<!--        <el-table-column-->
+<!--          align="center"-->
+<!--          prop="id"-->
+<!--          label="序号"-->
+<!--          width="80">-->
+<!--        </el-table-column>-->
+        <el-table-column
+          align="center"
+          prop="materielId"
+          label="物料信息"
+          width="180">
+          <template v-slot:default="scope">
+            <el-select v-model="scope.row.materielId" size="small" placeholder="请选择物料">
+              <el-option
+                v-for="(option, index) in materiels"
+                :key="index"
+                :label="option.materielName"
+                :value="option.id"
+              ></el-option>
+            </el-select>
+          </template>
+        </el-table-column>
+        <el-table-column
+          align="center"
+          prop="quantity"
+          label="数量/重量"
+          width="180">
+          <template v-slot:default="scope">
+            <el-input v-model="scope.row.quantity" size="small"></el-input>
+          </template>
+        </el-table-column>
+        <el-table-column
+          align="center"
+          prop="remark"
+          label="备注">
+          <template v-slot:default="scope">
+            <el-input v-model="scope.row.remark" size="small"></el-input>
+          </template>
+        </el-table-column>
+        <el-table-column label="操作" align="center">
+          <template v-slot:default="scope">
+            <el-button
+              size="mini"
+              type="danger"
+              @click="handleRowDelete(scope.$index, scope.row)">删除</el-button>
+          </template>
+        </el-table-column>
+      </el-table>
+      <!-- 添加一行数据 -->
+      <el-button
+        type="primary"
+        class="buttonAdd"
+        icon="el-icon-plus"
+        @click="addRow"
+      >添加一行</el-button>
+
+      <span slot="footer" class="dialog-footer">
+            <el-button @click="insertFrom=false">取 消</el-button>
+            <el-button type="primary" @click="insertTableRequest">确 定</el-button>
+           </span>
+    </el-dialog>
+
     <!-- 打印弹窗 -->
     <el-dialog title="采购单详情" :visible.sync="viewPurchaseOrderDetailsShow" width="1000px">
        <div class="titleDiv">
@@ -411,8 +522,8 @@ import {
   btnCommonApi,
   addTableData,
   batchEdit,
-  getStatisticList,
 } from "@/api/tablelist/commonTable";
+import {getListSupplier, getListMateriel, addPurchase, getPurchaseInfos, updatePurchase} from "@/api/supplier/supplier";
 import { listData } from "@/api/system/tenant/data";
 import { getPurchaseInfo } from "@/api/tablelist/purchaseInfo";
 import { getToken } from "@/utils/auth";
@@ -434,6 +545,13 @@ export default {
   components: { Queryfrom, Menu, DialogTemplate, FormList, BtnMenuList },
   data() {
     return {
+      insertTable: [],
+      labelPosition: 'right',
+      insertFromTitle:'',
+      insertFormData:{},
+      suppliers:[{"id":1,"name":"供应商1"}],
+      insertFrom:false,
+      materiels:[],
       particularsOfSalesNote:{
          purchaseOrderNumber:"",
          supplierName:"",
@@ -579,6 +697,7 @@ export default {
     };
   },
   created() {
+
     // 得到当前展示的table的唯一标识
     this.tableKey = this.$route.query.tableKey;
   },
@@ -599,6 +718,118 @@ export default {
     // },
   },
   methods: {
+    caiGouUpdate(btnInfo,row){
+      this.insertFromTitle = "修改采购信息";
+      this.insertFrom = true;
+      this.insertFormData={}
+      this.insertTable=[];
+      this.getListMateriel();
+      this.getListSupplier();
+      console.log(row)
+      // row.purchaseId getInfoEditPurchaseId PurchaseId
+      getPurchaseInfos(row.purchaseSerialNumber).then(res=>{
+        this.insertFormData=res.data;
+        this.insertTable=res.data.purchaseInfos;
+      })
+    },
+    insertTableRequest(){
+      if(this.insertFromTitle=="新增采购信息"){
+        console.log(this.insertFormData.supplierNo)
+        if(this.insertFormData.supplierNo!=undefined&&this.insertFormData.lotNumber!=undefined&&this.insertFormData.useDepartment!=undefined&&this.insertFormData.remark!=undefined){
+          //携带表格数据
+          this.insertFormData.purchaseInfos=this.insertTable;
+          addPurchase(this.insertFormData).then(res=>{
+            if(res.code==200){
+              this.$message({
+                message: '添加成功',
+                type: 'success'
+              });
+              this.insertFrom = false;
+            }else {
+              this.$message({
+                message: '添加失败',
+                type: 'warning'
+              });
+            }
+          })
+        }else {
+          this.$message({
+            message: '请完善表单',
+            type: 'warning'
+          });
+        }
+      }else {
+        console.log(this.insertFormData.supplierNo)
+        if(this.insertFormData.supplierNo!=undefined&&this.insertFormData.lotNumber!=undefined&&this.insertFormData.useDepartment!=undefined&&this.insertFormData.remark!=undefined){
+          //携带表格数据
+          this.insertFormData.purchaseInfos=this.insertTable;
+          updatePurchase(this.insertFormData).then(res=>{
+            if(res.code==200){
+              this.$message({
+                message: '修改成功',
+                type: 'success'
+              });
+              this.insertFrom = false;
+            }else {
+              this.$message({
+                message: '修改失败',
+                type: 'warning'
+              });
+            }
+          })
+        }else {
+          this.$message({
+            message: '请完善表单',
+            type: 'warning'
+          });
+        }
+      }
+      this.getList();
+    },
+    //原材料信息
+    getListMateriel(){
+      getListMateriel().then(res=>{
+        this.materiels=res.data;
+      })
+    },
+    //供应商信息
+    getListSupplier(){
+      getListSupplier().then(res=>{
+        this.suppliers=res.data
+      })
+    },
+    //删除一行
+    handleRowDelete($index,rwo){
+      this.insertTable.splice($index,1)
+    },
+    //添加一行
+    addRow(){
+      // 添加一行数据 id materielId quantity remark
+      const newRow = {
+        id: this.insertTable.length+1,
+        materielId: undefined,
+        quantity: undefined,
+        remark:undefined,
+        disableInput: false,
+      };
+      this.insertTable.push(newRow);
+    },
+    //关闭逻辑
+    insertFromClose(){
+      this.insertFrom = false;
+    },
+    insertFromHander(){
+      this.insertFromTitle = "新增采购信息";
+      // this.insertFormData.supplierNo=undefined
+      // this.insertFormData.lotNumber=undefined
+      // this.insertFormData.useDepartment=undefined
+      // this.insertFormData.remark=undefined
+      this.insertFormData={};
+      this.insertTable=[];
+      this.insertFrom = true;
+      this.getListSupplier();
+      this.getListMateriel();
+    },
     //打印逻辑方法
     toPrint(rwoIndex,row){
       console.log(rwoIndex,row);
@@ -617,7 +848,6 @@ export default {
         stringInner +"@"+
         row.materieColorNumber +"@"+
         row.materielId
-      alert(codeString)
       // const encodePwd = Base64.encode(codeString);//加密
       const encodePwd = encodeURIComponent(codeString)
 
@@ -695,9 +925,17 @@ export default {
             btnShowCondition: "",
             children: [],
           });
+          this.excuteBtnArr[0].children.push({
+            btnName: "采购修改",
+            btnType: "caiGouUpdate",
+            btnIcon: "el-icon-edit",
+            btnShowCondition: "",
+            children: [],
+          });
           this.topBtnArr = res.data.resultMap.button?.filter(
             (item) => item.btnGroupType == "top"
           );
+          console.log(this.topBtnArr,"dddddddddd");
           this.calcuteExcuteCol();
           this.$nextTick(() => {
             this.$refs.tableRef.doLayout();
@@ -742,15 +980,15 @@ export default {
             this.loading = false;
           });
 
-          // 查询统计信息
-          getStatisticList({
-            queryMap: {
-              tableKey: this.templateInfo.template.tableKey,
-              queryCriteriaValue: this.queryParams.queryMap.queryCriteriaValue,
-            },
-          }).then((res) => {
-            this.statisticList = res.data;
-          });
+          // // 查询统计信息
+          // getStatisticList({
+          //   queryMap: {
+          //     tableKey: this.templateInfo.template.tableKey,
+          //     queryCriteriaValue: this.queryParams.queryMap.queryCriteriaValue,
+          //   },
+          // }).then((res) => {
+          //   this.statisticList = res.data;
+          // });
         });
     },
     isUpperCase(char) {
@@ -1041,13 +1279,13 @@ export default {
           let tablesubKey = res.data.result.dragTables[1].tableKey;
 
           // 查询统计信息
-          getStatisticList({
-            queryMap: {
-              tableKey: tablesubKey,
-            },
-          }).then((res) => {
-            this.subCount = res.data;
-          });
+          // getStatisticList({
+          //   queryMap: {
+          //     tableKey: tablesubKey,
+          //   },
+          // }).then((res) => {
+          //   this.subCount = res.data;
+          // });
 
           let prmKey = this.templateInfo.template.primaryKey;
           let pkey = prmKey.replace(/_([a-z])/g, (match, p1) =>
@@ -1069,9 +1307,9 @@ export default {
           data.queryMap[key] =
             "'" + obj[this.templateInfo.template.primaryKey] + "'";
 
-          getStatisticList(data).then((res) => {
-            this.tableCount = res.data;
-          });
+          // getStatisticList(data).then((res) => {
+          //   this.tableCount = res.data;
+          // });
         }
 
         // let fieldList = Object.keys(resultMap);
@@ -2107,6 +2345,9 @@ export default {
         case "viewPurchaseOrderDetails":
           this.viewPurchaseOrderDetails(btnData, row);
           break;
+        case "caiGouUpdate":
+          this.caiGouUpdate(btnData, row);
+          break;
         default:
           break;
       }
@@ -2152,7 +2393,10 @@ export default {
           this.handleBatchDelete();
           break;
         case "INSERT":
+          //拖拽逻辑
           this.handleUpdate(row, btnData);
+          //手写逻辑
+          // this.insertFromHander();
           break;
         case "IMPORT":
           this.upload.open = true;