Browse Source

购销计划通知单下拉

Signed-off-by: tangsong <86121657@qq.com>
tangsong 4 months ago
parent
commit
4cf30e6afb
19 changed files with 713 additions and 269 deletions
  1. 0 1
      src/main/java/com/unis/crk/common/controller/BillnonewController.java
  2. 3 1
      src/main/java/com/unis/crk/common/service/impl/BillnonewServiceImpl.java
  3. 8 8
      src/main/java/com/unis/crk/common/service/impl/DataCenterDownloadServiceImpl.java
  4. 1 1
      src/main/java/com/unis/crk/common/service/impl/UpdataLogServiceImpl.java
  5. 145 117
      src/main/java/com/unis/crk/cplbusiness/controller/DataCrkywCpltzdxxDefaultController.java
  6. 140 0
      src/main/java/com/unis/crk/cplbusiness/entity/result/BusinessPgGopsPlanDetailVO.java
  7. 83 0
      src/main/java/com/unis/crk/cplbusiness/entity/result/BusinessPgGopsPlanVO.java
  8. 28 0
      src/main/java/com/unis/crk/cplbusiness/mapper/DataCrkywCpltzdxxDefaultMapper.java
  9. 25 0
      src/main/java/com/unis/crk/cplbusiness/service/IDataCrkywCpltzdxxDefaultService.java
  10. 15 12
      src/main/java/com/unis/crk/cplbusiness/service/impl/DataCrkywCplckFlt001ServiceImpl.java
  11. 2 2
      src/main/java/com/unis/crk/cplbusiness/service/impl/DataCrkywCplfjDefaultServiceImpl.java
  12. 91 86
      src/main/java/com/unis/crk/cplbusiness/service/impl/DataCrkywCplrkDefaultServiceImpl.java
  13. 12 35
      src/main/java/com/unis/crk/cplbusiness/service/impl/DataCrkywCplrkFlt001ServiceImpl.java
  14. 54 0
      src/main/java/com/unis/crk/cplbusiness/service/impl/DataCrkywCpltzdxxDefaultServiceImpl.java
  15. 2 2
      src/main/java/com/unis/crk/cplbusiness/service/impl/DataKcglCplkcbdDefaultServiceImpl.java
  16. 2 2
      src/main/java/com/unis/crk/cplbusiness/service/impl/DataKcglCplqckcDefaultServiceImpl.java
  17. 1 1
      src/main/java/com/unis/crk/cplbusiness/service/impl/LiAfterSaleServiceImpl.java
  18. 1 1
      src/main/java/com/unis/crk/cplbusiness/service/impl/LiOrderServiceImpl.java
  19. 100 0
      src/main/resources/mapper/cplbusiness/DataCrkywCpltzdxxDefaultMapper.xml

+ 0 - 1
src/main/java/com/unis/crk/common/controller/BillnonewController.java

@@ -78,7 +78,6 @@ public class BillnonewController {
78 78
      * @param unitId 单位id
79 79
      * @param spbh 商品编号
80 80
      * @param scrq 商品生产日期
81
-     * @param scrq 供应商Id
82 81
      * @return
83 82
      */
84 83
     @ApiOperation(value="查询", notes="得到生产批号")

+ 3 - 1
src/main/java/com/unis/crk/common/service/impl/BillnonewServiceImpl.java

@@ -140,10 +140,12 @@ public class BillnonewServiceImpl extends ServiceImpl<BillnonewMapper, Billnonew
140 140
             DataCrkywGysDefault dataCrkywGysDefault = dataCrkywGysDefaultService.getById(gysId);
141 141
             if (dataCrkywGysDefault != null){
142 142
                 gysId = dataCrkywGysDefault.getSupplierNumber();
143
+            }else{
144
+                gysId = "";
143 145
             }
144 146
         }
145 147
         String date =  DateUtil.format(DateUtil.parse(scrq,"yyyy-MM-dd"),"yyyyMMdd");
146
-        return spbh+date+"_"+gysId;
148
+        return spbh+date+(StringUtils.isNotBlank(gysId)?"_"+gysId:"");
147 149
     }
148 150
 
149 151
     @Override

+ 8 - 8
src/main/java/com/unis/crk/common/service/impl/DataCenterDownloadServiceImpl.java

@@ -183,7 +183,7 @@ public class DataCenterDownloadServiceImpl implements IDataCenterDownloadService
183 183
                         dataCrkywCpltzdxxFlt001.setWcsl(0.0); //完成数量
184 184
                         dataCrkywCpltzdxxFlt001.setSl(dataCrkywCpltzdxxFlt001.getJs() * Double.parseDouble(dataCrkywCpltzdxxFlt001.getGg())); //完成数量
185 185
                         dataCrkywCpltzdxxFlt001.setSysl(dataCrkywCpltzdxxFlt001.getSl()); //剩余数量
186
-                        dataCrkywCpltzdxxFlt001.setXz("952751"); //性质默认
186
+                        dataCrkywCpltzdxxFlt001.setXz("6871"); //性质默认
187 187
                         //剩余数量=数量-完成数量(0)
188 188
     //                    dataCrkywCpltzdxxFlt001.setSysl(dataCrkywCpltzdxxFlt001.getSl() - dataCrkywCpltzdxxFlt001.getWcsl());
189 189
                         if (StringUtils.isBlank(dataCrkywCpltzdxxFlt001.getBuilder())) {
@@ -1312,7 +1312,7 @@ public class DataCenterDownloadServiceImpl implements IDataCenterDownloadService
1312 1312
                     dataKcglCplkcbdDefault.setModifyDate(next.getModifiedTime());
1313 1313
                     dataKcglCplkcbdDefault.setBdhjs(next.getQuantity()+next.getInventoryQuantity()); //变动后件数
1314 1314
                     dataKcglCplkcbdDefault.setBdhsl((next.getInventoryQuantity() + next.getQuantity()) * Double.parseDouble(next.getMaterielModel()));//变动后件数
1315
-                    dataKcglCplkcbdDefault.setBdhxz("952751");
1315
+                    dataKcglCplkcbdDefault.setBdhxz("6871");
1316 1316
                     //获取商品信息
1317 1317
                     ArrayList<String> strings = new ArrayList<>();
1318 1318
                     strings.add(next.getMaterielNum());
@@ -1338,10 +1338,10 @@ public class DataCenterDownloadServiceImpl implements IDataCenterDownloadService
1338 1338
                     dataKcglCplkcbdDefault.setSjjlspmcbh(next.getMaterielNum());
1339 1339
                     dataKcglCplkcbdDefault.setBz("成品粮生产加工入库");
1340 1340
                     dataKcglCplkcbdDefault.setScrq(next.getManufactureDate());
1341
-                    dataKcglCplkcbdDefault.setXz("952751");
1341
+                    dataKcglCplkcbdDefault.setXz("6871");
1342 1342
                     dataKcglCplkcbdDefault.setYwsj(next.getCreatedTime());
1343 1343
                     dataKcglCplkcbdDefault.setBddh(next.getName());
1344
-                    dataKcglCplkcbdDefault.setBdhxz("952751");
1344
+                    dataKcglCplkcbdDefault.setBdhxz("6871");
1345 1345
 
1346 1346
                     cplkcbd.add(dataKcglCplkcbdDefault);
1347 1347
                     //新增修改时先删除
@@ -1480,8 +1480,8 @@ public class DataCenterDownloadServiceImpl implements IDataCenterDownloadService
1480 1480
 
1481 1481
             for (int i = 0; i < dataList.size(); i++) {
1482 1482
                 DataKcglCplkcbdDefault next = dataList.get(i);
1483
-                next.setXz("952751");
1484
-                next.setBdhxz("952751");
1483
+                next.setXz("6871");
1484
+                next.setBdhxz("6871");
1485 1485
                 next.setBdfs("14");
1486 1486
                 System.out.println(next.toString());
1487 1487
                 saveYc.add(next);
@@ -1544,8 +1544,8 @@ public class DataCenterDownloadServiceImpl implements IDataCenterDownloadService
1544 1544
 
1545 1545
             for (int i = 0; i < dataList.size(); i++) {
1546 1546
                 DataKcglCplkcbdDefault next = dataList.get(i);
1547
-                next.setXz("952751");
1548
-                next.setBdhxz("952751");
1547
+                next.setXz("6871");
1548
+                next.setBdhxz("6871");
1549 1549
                 next.setBdfs("14");
1550 1550
                 System.out.println(next.toString());
1551 1551
                 saveYc.add(next);

+ 1 - 1
src/main/java/com/unis/crk/common/service/impl/UpdataLogServiceImpl.java

@@ -1460,7 +1460,7 @@ public class UpdataLogServiceImpl extends ServiceImpl<UpdataLogMapper, UpdataLog
1460 1460
                         dataCrkywCpltzdxxFlt001.setRoundID(0); //舍位id
1461 1461
                         dataCrkywCpltzdxxFlt001.setWcsl(0.0); //完成数量
1462 1462
                         dataCrkywCpltzdxxFlt001.setSysl(dataCrkywCpltzdxxFlt001.getSl()); //剩余数量
1463
-                        dataCrkywCpltzdxxFlt001.setXz("952751"); //性质默认
1463
+                        dataCrkywCpltzdxxFlt001.setXz("6871"); //性质默认
1464 1464
                         //剩余数量=数量-完成数量(0)
1465 1465
                         dataCrkywCpltzdxxFlt001.setSysl(dataCrkywCpltzdxxFlt001.getSl()-dataCrkywCpltzdxxFlt001.getWcsl());
1466 1466
                         if (StringUtils.isBlank(dataCrkywCpltzdxxFlt001.getBuilder())){

+ 145 - 117
src/main/java/com/unis/crk/cplbusiness/controller/DataCrkywCpltzdxxDefaultController.java

@@ -4,6 +4,8 @@ import cn.hutool.json.JSONObject;
4 4
 import com.baomidou.mybatisplus.core.metadata.IPage;
5 5
 import com.unis.crk.aop.SystemLog;
6 6
 import com.unis.crk.cplbusiness.entity.DataCrkywCpltzdxxDefault;
7
+import com.unis.crk.cplbusiness.entity.result.BusinessPgGopsPlanDetailVO;
8
+import com.unis.crk.cplbusiness.entity.result.BusinessPgGopsPlanVO;
7 9
 import com.unis.crk.cplbusiness.entity.vo.DataCrkywCpltzdxxDefaultVo;
8 10
 import com.unis.crk.cplbusiness.service.IDataCrkywCpltzdxxDefaultService;
9 11
 import com.unis.crk.utils.ResultUtil;
@@ -29,7 +31,7 @@ import java.util.Map;
29 31
  * @since 2022-03-23
30 32
  */
31 33
 @CrossOrigin
32
-@Api(value = "成品粮出入库订单",tags = {"成品粮出入库订单"})
34
+@Api(value = "成品粮购销计划单",tags = {"成品粮购销计划单"})
33 35
 @RestController
34 36
 @RequestMapping("dataCrkywCpltzdxxDefault")
35 37
 public class DataCrkywCpltzdxxDefaultController {
@@ -40,115 +42,141 @@ public class DataCrkywCpltzdxxDefaultController {
40 42
     @Autowired
41 43
     private IDataCrkywCpltzdxxDefaultService dataCrkywCpltzdxxDefaultService;
42 44
     /**
43
-     * 通过单位Id及作业类型得到成品粮通知单下拉列表
45
+     * 库级购销计划:通过单位Id及作业类型得到下拉列表
44 46
      * @param unitId 单位id
45
-     * @param zylx 作业类型:成品粮入库:3,成品粮出库:4
46
-     * @return
47
+     * @param planType 计划类型,1:销售计划;2:收购计划
48
+     * @returnT
47 49
      */
48
-    @ApiOperation(value="查询", notes="通过单位Id及作业类型得到成品粮通知单下拉列表")
49
-    @GetMapping({"/getCplTzdList/{unitId}/{zylx}","/getCplTzdList/{unitId}"})
50
-    public ResultUtil getCplTzdList(@PathVariable(value = "unitId",required = false) String unitId,@PathVariable(value = "zylx",required = false) String zylx) {
51
-        ResultUtil<List<Map<String,Object>>> data = new ResultUtil<>();
52
-        data.success(this.dataCrkywCpltzdxxDefaultService.getCplTzdList(unitId,zylx));
50
+    @ApiOperation(value="查询", notes="库级购销计划:通过单位Id及作业类型得到下拉列表")
51
+    @GetMapping({"/getPgGopsPlanList/{unitId}/{planType}"})
52
+    public ResultUtil getPgGopsPlanList(@PathVariable(value = "unitId") String unitId,@PathVariable(value = "planType") String planType) {
53
+        ResultUtil<List<BusinessPgGopsPlanVO>> data = new ResultUtil<>();
54
+        data.success(this.dataCrkywCpltzdxxDefaultService.getPgGopsPlanList(unitId,planType));
53 55
         return data;
54 56
     }
57
+
55 58
     /**
56
-     * 通过主表主键Id到成品粮通知单出入库从表列表
59
+     * 库级购销计划详情:通过主表主键Id到列表
57 60
      * @param mainDataId 主表主键id
58 61
      */
59
-    @ApiOperation(value="查询", notes="通过主表主键Id到成品粮通知单出入库从表列表")
60
-    @GetMapping({"/getCplCrkTzdFltList/{mainDataId}"})
61
-    public ResultUtil getCplCrkTzdFltList(@PathVariable(value = "mainDataId",required = true) String mainDataId) {
62
-        ResultUtil<List<Map<String,Object>>> data = new ResultUtil<>();
63
-        data.success(this.dataCrkywCpltzdxxDefaultService.getCplCrkTzdFltList(mainDataId));
62
+    @ApiOperation(value="查询", notes="库级购销计划详情:通过主表主键Id到列表")
63
+    @GetMapping({"/getPgGopsPlanDetailList/{mainDataId}"})
64
+    public ResultUtil getPgGopsPlanDetailList(@PathVariable(value = "mainDataId") String mainDataId) {
65
+        ResultUtil<List<BusinessPgGopsPlanDetailVO>> data = new ResultUtil<>();
66
+        data.success(this.dataCrkywCpltzdxxDefaultService.getPgGopsPlanDetailList(mainDataId));
64 67
         return data;
65 68
     }
66 69
 
67 70
     /**
71
+     * 通过单位Id及作业类型得到成品粮通知单下拉列表
72
+     * @param unitId 单位id
73
+     * @param zylx 作业类型:成品粮入库:3,成品粮出库:4
74
+     * @return
75
+     */
76
+//    @ApiOperation(value="查询", notes="通过单位Id及作业类型得到成品粮通知单下拉列表")
77
+//    @GetMapping({"/getCplTzdList/{unitId}/{zylx}","/getCplTzdList/{unitId}"})
78
+//    public ResultUtil getCplTzdList(@PathVariable(value = "unitId",required = false) String unitId,@PathVariable(value = "zylx",required = false) String zylx) {
79
+//        ResultUtil<List<Map<String,Object>>> data = new ResultUtil<>();
80
+//        data.success(this.dataCrkywCpltzdxxDefaultService.getCplTzdList(unitId,zylx));
81
+//        return data;
82
+//    }
83
+    /**
68 84
      * 通过主表主键Id到成品粮通知单出入库从表列表
69 85
      * @param mainDataId 主表主键id
70 86
      */
71
-    @ApiOperation(value="查询", notes="通过主表主键Id到成品粮通知单出入库从表列表")
72
-    @GetMapping({"/getCplCrkTzdFltListAndsp/{mainDataId}"})
73
-    public ResultUtil getCplCrkTzdFltListAndsp(@PathVariable(value = "mainDataId",required = true) String mainDataId) {
74
-        ResultUtil<Map<String,Object>> data = new ResultUtil<>();
75
-        data.success(this.dataCrkywCpltzdxxDefaultService.getCplCrkTzdFltListAndsp(mainDataId));
76
-        return data;
77
-    }
87
+//    @ApiOperation(value="查询", notes="通过主表主键Id到成品粮通知单出入库从表列表")
88
+//    @GetMapping({"/getCplCrkTzdFltList/{mainDataId}"})
89
+//    public ResultUtil getCplCrkTzdFltList(@PathVariable(value = "mainDataId",required = true) String mainDataId) {
90
+//        ResultUtil<List<Map<String,Object>>> data = new ResultUtil<>();
91
+//        data.success(this.dataCrkywCpltzdxxDefaultService.getCplCrkTzdFltList(mainDataId));
92
+//        return data;
93
+//    }
94
+
95
+    /**
96
+     * 通过主表主键Id到成品粮通知单出入库从表列表
97
+     * @param mainDataId 主表主键id
98
+     */
99
+//    @ApiOperation(value="查询", notes="通过主表主键Id到成品粮通知单出入库从表列表")
100
+//    @GetMapping({"/getCplCrkTzdFltListAndsp/{mainDataId}"})
101
+//    public ResultUtil getCplCrkTzdFltListAndsp(@PathVariable(value = "mainDataId",required = true) String mainDataId) {
102
+//        ResultUtil<Map<String,Object>> data = new ResultUtil<>();
103
+//        data.success(this.dataCrkywCpltzdxxDefaultService.getCplCrkTzdFltListAndsp(mainDataId));
104
+//        return data;
105
+//    }
78 106
     /**
79 107
      * 通过单位Id及作业类型得到成品粮通知单出入库下拉列表
80 108
      * @param unitId 单位id
81 109
      * @param zylx 作业类型:成品粮正常入库:3,成品粮出库:4,成品粮退货入库:5
82 110
      * @return
83 111
      */
84
-    @ApiOperation(value="查询", notes="成品粮(正常,退货)入库:3;成品粮出库:4。成品粮退货入库:5。成品粮正常入库:7")
85
-    @GetMapping({"/getCplCrkTzdList/{unitId}/{zylx}","/getCplCrkTzdList/{unitId}"})
86
-    public ResultUtil getCplCrkTzdList(@PathVariable(value = "unitId",required = false) String unitId,@PathVariable(value = "zylx",required = false) String zylx) {
87
-        ResultUtil<List<Map<String,Object>>> data = new ResultUtil<>();
88
-        data.success(this.dataCrkywCpltzdxxDefaultService.getCplCrkTzdList(unitId,zylx));
89
-        return data;
90
-    }
112
+//    @ApiOperation(value="查询", notes="成品粮(正常,退货)入库:3;成品粮出库:4。成品粮退货入库:5。成品粮正常入库:7")
113
+//    @GetMapping({"/getCplCrkTzdList/{unitId}/{zylx}","/getCplCrkTzdList/{unitId}"})
114
+//    public ResultUtil getCplCrkTzdList(@PathVariable(value = "unitId",required = false) String unitId,@PathVariable(value = "zylx",required = false) String zylx) {
115
+//        ResultUtil<List<Map<String,Object>>> data = new ResultUtil<>();
116
+//        data.success(this.dataCrkywCpltzdxxDefaultService.getCplCrkTzdList(unitId,zylx));
117
+//        return data;
118
+//    }
91 119
 
92 120
     /**
93 121
      * 根据ID查询数据
94 122
      * @param id
95 123
      * @return
96 124
      */
97
-    @ApiOperation(value="查询", notes="根据ID查询数据")
98
-    @GetMapping("getOne/{id}")
99
-    public ResultUtil getOne(@PathVariable("id") String id){
100
-        LOGGER.info("入参为:{}",id);
101
-        ResultUtil<DataCrkywCpltzdxxDefault> data = new ResultUtil<>();
102
-        if (StringUtils.isEmpty(id)){
103
-            data.failed("传入的主键为空");
104
-            return data;
105
-        }
106
-        data.success(this.dataCrkywCpltzdxxDefaultService.getOneData(id));
107
-        return data;
108
-    }
125
+//    @ApiOperation(value="查询", notes="根据ID查询数据")
126
+//    @GetMapping("getOne/{id}")
127
+//    public ResultUtil getOne(@PathVariable("id") String id){
128
+//        LOGGER.info("入参为:{}",id);
129
+//        ResultUtil<DataCrkywCpltzdxxDefault> data = new ResultUtil<>();
130
+//        if (StringUtils.isEmpty(id)){
131
+//            data.failed("传入的主键为空");
132
+//            return data;
133
+//        }
134
+//        data.success(this.dataCrkywCpltzdxxDefaultService.getOneData(id));
135
+//        return data;
136
+//    }
109 137
 
110 138
     /**
111 139
          * 分页高级查询
112 140
          * @return
113 141
          */
114
-    @ApiOperation(value="查询", notes="分页高级查询")
115
-    @PostMapping(value="/findPage")
116
-    public ResultUtil findPage(@RequestBody DataCrkywCpltzdxxDefaultVo pageQuery) {
117
-        ResultUtil<IPage<Map<String,Object>>> data = new ResultUtil<>();
118
-        data.success(this.dataCrkywCpltzdxxDefaultService.findPageVo(pageQuery));
119
-        return data;
120
-    }
142
+//    @ApiOperation(value="查询", notes="分页高级查询")
143
+//    @PostMapping(value="/findPage")
144
+//    public ResultUtil findPage(@RequestBody DataCrkywCpltzdxxDefaultVo pageQuery) {
145
+//        ResultUtil<IPage<Map<String,Object>>> data = new ResultUtil<>();
146
+//        data.success(this.dataCrkywCpltzdxxDefaultService.findPageVo(pageQuery));
147
+//        return data;
148
+//    }
121 149
 
122 150
     /**
123 151
      * 新增一条数据
124 152
      * @param param
125 153
      * @return
126 154
      */
127
-    @ApiOperation(value="新增", notes="新增一条数据")
128
-    @PostMapping("add")
129
-    @SystemLog(module = "成品通知单", methods = "新增",uploadName = "cpl.tzd")
130
-    public ResultUtil add(@RequestBody DataCrkywCpltzdxxDefault param){
131
-        LOGGER.info("入参为:{}", param);
132
-        ResultUtil<Boolean> data = new ResultUtil<>();
133
-        if (ObjectUtils.isEmpty(param)){
134
-            data.failed("所接收对象为null");
135
-            return data;
136
-        }
137
-        JSONObject ret = new JSONObject();
138
-        try{
139
-            ret  = this.dataCrkywCpltzdxxDefaultService.saveData(param);
140
-        }catch (Exception e){
141
-            ret.set("success", false);
142
-            ret.set("msg", e.getMessage());
143
-        }
144
-        if (ret.getBool("success")){
145
-            data.success(ret.getStr("msg"));
146
-        }else {
147
-            data.failed(ret.getStr("msg"));
148
-        }
149
-
150
-        return data;
151
-    }
155
+//    @ApiOperation(value="新增", notes="新增一条数据")
156
+//    @PostMapping("add")
157
+//    @SystemLog(module = "成品通知单", methods = "新增",uploadName = "cpl.tzd")
158
+//    public ResultUtil add(@RequestBody DataCrkywCpltzdxxDefault param){
159
+//        LOGGER.info("入参为:{}", param);
160
+//        ResultUtil<Boolean> data = new ResultUtil<>();
161
+//        if (ObjectUtils.isEmpty(param)){
162
+//            data.failed("所接收对象为null");
163
+//            return data;
164
+//        }
165
+//        JSONObject ret = new JSONObject();
166
+//        try{
167
+//            ret  = this.dataCrkywCpltzdxxDefaultService.saveData(param);
168
+//        }catch (Exception e){
169
+//            ret.set("success", false);
170
+//            ret.set("msg", e.getMessage());
171
+//        }
172
+//        if (ret.getBool("success")){
173
+//            data.success(ret.getStr("msg"));
174
+//        }else {
175
+//            data.failed(ret.getStr("msg"));
176
+//        }
177
+//
178
+//        return data;
179
+//    }
152 180
 
153 181
 
154 182
     /**
@@ -156,32 +184,32 @@ public class DataCrkywCpltzdxxDefaultController {
156 184
      * @param param
157 185
      * @return
158 186
      */
159
-    @ApiOperation(value="修改", notes="修改一条数据")
160
-    @PatchMapping("edit")
161
-    @SystemLog(module = "成品通知单", methods = "修改",uploadName = "cpl.tzd")
162
-    public ResultUtil edit(@RequestBody  DataCrkywCpltzdxxDefault param){
163
-        LOGGER.info("入参为:{}", param);
164
-        ResultUtil<Boolean> data = new ResultUtil<>();
165
-        if (ObjectUtils.isEmpty(param)){
166
-        data.failed("所接收对象为null");
167
-        return data;
168
-        }
169
-        JSONObject ret = new JSONObject();
170
-        try{
171
-            ret  = this.dataCrkywCpltzdxxDefaultService.update(param);
172
-        }catch (Exception e){
173
-            e.printStackTrace();
174
-            ret.set("success", false);
175
-            ret.set("msg", e.getMessage());
176
-        }
177
-        if (ret.getBool("success")){
178
-            data.success(ret.getStr("msg"));
179
-        }else {
180
-            data.failed(ret.getStr("msg"));
181
-        }
182
-
183
-        return data;
184
-    }
187
+//    @ApiOperation(value="修改", notes="修改一条数据")
188
+//    @PatchMapping("edit")
189
+//    @SystemLog(module = "成品通知单", methods = "修改",uploadName = "cpl.tzd")
190
+//    public ResultUtil edit(@RequestBody  DataCrkywCpltzdxxDefault param){
191
+//        LOGGER.info("入参为:{}", param);
192
+//        ResultUtil<Boolean> data = new ResultUtil<>();
193
+//        if (ObjectUtils.isEmpty(param)){
194
+//        data.failed("所接收对象为null");
195
+//        return data;
196
+//        }
197
+//        JSONObject ret = new JSONObject();
198
+//        try{
199
+//            ret  = this.dataCrkywCpltzdxxDefaultService.update(param);
200
+//        }catch (Exception e){
201
+//            e.printStackTrace();
202
+//            ret.set("success", false);
203
+//            ret.set("msg", e.getMessage());
204
+//        }
205
+//        if (ret.getBool("success")){
206
+//            data.success(ret.getStr("msg"));
207
+//        }else {
208
+//            data.failed(ret.getStr("msg"));
209
+//        }
210
+//
211
+//        return data;
212
+//    }
185 213
 
186 214
 
187 215
     /**
@@ -189,23 +217,23 @@ public class DataCrkywCpltzdxxDefaultController {
189 217
      * @param id
190 218
      * @return
191 219
      */
192
-    @ApiOperation(value="删除", notes="根据ID删除数据")
193
-    @DeleteMapping("delete/{id}")
194
-    @SystemLog(module = "成品通知单", methods = "删除",uploadName = "cpl.tzd")
195
-    public ResultUtil delete(@PathVariable("id") String id){
196
-        LOGGER.info("入参为:{}", id);
197
-        ResultUtil<Boolean> data = new ResultUtil<>();
198
-        if (StringUtils.isEmpty(id)){
199
-            data.failed("所接收id为null");
200
-            return data;
201
-        }
202
-        JSONObject ret  = this.dataCrkywCpltzdxxDefaultService.delete(id);
203
-        if (ret.getBool("success")){
204
-        data.success(ret.getStr("msg"));
205
-        }else {
206
-        data.failed(ret.getStr("msg"));
207
-        }
208
-        return data;
209
-    }
220
+//    @ApiOperation(value="删除", notes="根据ID删除数据")
221
+//    @DeleteMapping("delete/{id}")
222
+//    @SystemLog(module = "成品通知单", methods = "删除",uploadName = "cpl.tzd")
223
+//    public ResultUtil delete(@PathVariable("id") String id){
224
+//        LOGGER.info("入参为:{}", id);
225
+//        ResultUtil<Boolean> data = new ResultUtil<>();
226
+//        if (StringUtils.isEmpty(id)){
227
+//            data.failed("所接收id为null");
228
+//            return data;
229
+//        }
230
+//        JSONObject ret  = this.dataCrkywCpltzdxxDefaultService.delete(id);
231
+//        if (ret.getBool("success")){
232
+//        data.success(ret.getStr("msg"));
233
+//        }else {
234
+//        data.failed(ret.getStr("msg"));
235
+//        }
236
+//        return data;
237
+//    }
210 238
 }
211 239
 

+ 140 - 0
src/main/java/com/unis/crk/cplbusiness/entity/result/BusinessPgGopsPlanDetailVO.java

@@ -0,0 +1,140 @@
1
+package com.unis.crk.cplbusiness.entity.result;
2
+
3
+import com.fasterxml.jackson.annotation.JsonFormat;
4
+import io.swagger.annotations.ApiModelProperty;
5
+import lombok.Getter;
6
+import lombok.Setter;
7
+
8
+import java.math.BigDecimal;
9
+import java.util.Date;
10
+
11
+/**
12
+ * 成品粮监管-购销计划管理-明细表实体
13
+ *
14
+ * @author TS
15
+ * @date  2024/07/08 15:42
16
+ **/
17
+@Getter
18
+@Setter
19
+public class BusinessPgGopsPlanDetailVO {
20
+
21
+    /** 明细记录唯一标识符 */
22
+    @ApiModelProperty(value = "明细记录唯一标识符", position = 1)
23
+    private Integer ddcbid;
24
+
25
+    /** 更新日期 */
26
+    @ApiModelProperty(value = "更新日期", position = 2)
27
+    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
28
+    private Date ModifyDate;
29
+
30
+
31
+    /** 商品;data_crkyw_cplsp_default的id; */
32
+    @ApiModelProperty(value = "商品;data_crkyw_cplsp_default的id;", position = 3)
33
+    private String crkywCplspDefaultId;
34
+
35
+    /** 性质Id */
36
+    @ApiModelProperty(value = "性质Id", position = 4)
37
+    private String xz;
38
+
39
+    /** 性质名称 */
40
+    @ApiModelProperty(value = "性质名称", position = 5)
41
+    private String xzValue;
42
+
43
+    /** 生产年份Id */
44
+    @ApiModelProperty(value = "生产年份Id", position = 5)
45
+    private String scnf;
46
+
47
+    /** 生产年份名称 */
48
+    @ApiModelProperty(value = "生产年份名称", position = 6)
49
+    private String scnfValue;
50
+
51
+    /** 产地Id */
52
+    @ApiModelProperty(value = "产地Id", position = 7)
53
+    private String cd;
54
+
55
+    /** 产地名称 */
56
+    @ApiModelProperty(value = "产地名称", position = 8)
57
+    private String cdValue;
58
+
59
+    /** 品种Id */
60
+    @ApiModelProperty(value = "品种Id", position = 9)
61
+    private String sjjlpzbh;
62
+
63
+    /** 品种名称 */
64
+    @ApiModelProperty(value = "品种名称", position = 10)
65
+    private String sjjlpzmc;
66
+
67
+    /** 等级Id */
68
+    @ApiModelProperty(value = "等级Id", position = 11)
69
+    private String sjjldjbh;
70
+
71
+    /** 等级名称 */
72
+    @ApiModelProperty(value = "等级名称", position = 12)
73
+    private String sjjldjmc;
74
+
75
+    /** 商品Id */
76
+    @ApiModelProperty(value = "商品Id", position = 13)
77
+    private String sjjlspmcbh;
78
+
79
+    /** 商品名称 */
80
+    @ApiModelProperty(value = "商品名称", position = 14)
81
+    private String sjjlspmc;
82
+
83
+    /** 品牌Id */
84
+    @ApiModelProperty(value = "品牌Id", position = 15)
85
+    private String sjjlppbh;
86
+
87
+    /** 商品名称 */
88
+    @ApiModelProperty(value = "sjjlppmc", position = 16)
89
+    private String sjjlppmc;
90
+
91
+
92
+    /** 数量 */
93
+    @ApiModelProperty(value = "数量", position = 17)
94
+    private BigDecimal sl;
95
+
96
+    /** 剩余数量 */
97
+    @ApiModelProperty(value = "剩余数量", position = 18)
98
+    private BigDecimal sysl;
99
+
100
+    /** 库存数量 */
101
+    @ApiModelProperty(value = "库存数量", position = 19)
102
+    private BigDecimal kcsl;
103
+
104
+    /** 库存件数 */
105
+    @ApiModelProperty(value = "库存件数", position = 20)
106
+    private BigDecimal syjs;
107
+
108
+    /** 仓库id */
109
+    @ApiModelProperty(value = "仓库id", position = 21)
110
+    private String ch;
111
+
112
+    @ApiModelProperty(value = "规格",position = 22)
113
+    private String gg;
114
+
115
+    @ApiModelProperty(value = "计量单位",position = 23)
116
+    private String jldw;
117
+
118
+    @ApiModelProperty(value = "计量单位名称",position = 24)
119
+    private String jldwmc;
120
+
121
+    @ApiModelProperty(value = "保质期",position = 25)
122
+    private String bzq;
123
+
124
+
125
+    @ApiModelProperty(value = "是含税 0是 1否", position = 26)
126
+    private String istax;
127
+
128
+    @ApiModelProperty(value = "税率", position = 27)
129
+    private Double taxrate;
130
+
131
+    /** 单价,单位:元 */
132
+    @ApiModelProperty(value = "单价,单位:元", position = 28)
133
+    private BigDecimal dj;
134
+
135
+    @ApiModelProperty(value = "完成数量", position = 29)
136
+    private BigDecimal wcsl;
137
+
138
+    @ApiModelProperty(value = "计划id", position = 30)
139
+    private Integer planId;
140
+}

+ 83 - 0
src/main/java/com/unis/crk/cplbusiness/entity/result/BusinessPgGopsPlanVO.java

@@ -0,0 +1,83 @@
1
+package com.unis.crk.cplbusiness.entity.result;
2
+
3
+import com.fasterxml.jackson.annotation.JsonFormat;
4
+import io.swagger.annotations.ApiModelProperty;
5
+import lombok.Getter;
6
+import lombok.Setter;
7
+
8
+import java.math.BigDecimal;
9
+import java.util.Date;
10
+import java.util.List;
11
+
12
+/**
13
+ * 成品粮监管-购销计划管理表实体
14
+ *
15
+ * @author TS
16
+ * @date  2024/07/08 15:41
17
+ **/
18
+@Getter
19
+@Setter
20
+public class BusinessPgGopsPlanVO {
21
+
22
+    /** 主键ID */
23
+    @ApiModelProperty(value = "主键ID", position = 1)
24
+    private String DataID;
25
+
26
+
27
+    /** 更新日期 */
28
+    @ApiModelProperty(value = "更新日期", position = 2)
29
+    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
30
+    private Date ModifyDate;
31
+
32
+    /** 库区;org_info的id; */
33
+    @ApiModelProperty(value = "库区;org_info的id;", position = 3)
34
+    private String orgId;
35
+
36
+    /** 计划编号 */
37
+    @ApiModelProperty(value = "计划编号", position = 4)
38
+    private String tzdbm;
39
+
40
+    /** 计划名称 */
41
+    @ApiModelProperty(value = "计划名称", position = 5)
42
+    private String jhdmc;
43
+
44
+    /** 合同名称 */
45
+    @ApiModelProperty(value = "合同名称", position = 6)
46
+    private String htmc;
47
+
48
+
49
+    /** 计划类型,1:销售计划;2:收购计划; */
50
+    @ApiModelProperty(value = "计划类型,1:销售计划;2:收购计划;", position = 7)
51
+    private Integer cazylx;
52
+
53
+    /** 计划类型名称 */
54
+    @ApiModelProperty(value = "计划类型名称", position = 8)
55
+    private String cazylxmc;
56
+
57
+
58
+    /** 客户名称 */
59
+    @ApiModelProperty(value = "客户名称", position = 10)
60
+    private String kfmc;
61
+
62
+    /** 客户编号 */
63
+    @ApiModelProperty(value = "客户编号", position = 11)
64
+    private String kfbh;
65
+
66
+    /** 计划数量 */
67
+    @ApiModelProperty(value = "计划数量", position = 12)
68
+    private Integer sl;
69
+
70
+    /** 完成数量 */
71
+    @ApiModelProperty(value = "完成数量", position = 13)
72
+    private Integer wcsl;
73
+
74
+    /** 剩余数量 */
75
+    @ApiModelProperty(value = "剩余数量", position = 14)
76
+    private Integer sysl;
77
+
78
+    /** 商品名称 */
79
+    @ApiModelProperty(value = "商品名称", position = 15)
80
+    private String mxpzValue;
81
+
82
+
83
+}

+ 28 - 0
src/main/java/com/unis/crk/cplbusiness/mapper/DataCrkywCpltzdxxDefaultMapper.java

@@ -6,8 +6,11 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
6 6
 import com.baomidou.mybatisplus.core.toolkit.Constants;
7 7
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
8 8
 import com.unis.crk.cplbusiness.entity.DataCrkywCpltzdxxDefault;
9
+import com.unis.crk.cplbusiness.entity.result.BusinessPgGopsPlanDetailVO;
10
+import com.unis.crk.cplbusiness.entity.result.BusinessPgGopsPlanVO;
9 11
 import org.apache.ibatis.annotations.Param;
10 12
 
13
+import java.math.BigDecimal;
11 14
 import java.util.List;
12 15
 import java.util.Map;
13 16
 
@@ -46,4 +49,29 @@ public interface DataCrkywCpltzdxxDefaultMapper extends BaseMapper<DataCrkywCplt
46 49
                                         @Param(value = "zylx")String zylx);
47 50
 
48 51
         IPage<Map<String, Object>> pfPage(Page<DataCrkywCpltzdxxDefault> p,@Param(Constants.WRAPPER)  QueryWrapper<DataCrkywCpltzdxxDefault> queryWrapper);
52
+
53
+    /**
54
+     * 通过单位Id及作业类型得到库级购销计划下拉列表
55
+     * @param unitId
56
+     * @param planType
57
+     * @return
58
+     */
59
+        List<BusinessPgGopsPlanVO> getPgGopsPlanList(@Param("unitId") String unitId, @Param("planType") String planType);
60
+    /**
61
+     * 库级购销计划详情:通过主表主键Id得到列表
62
+     *
63
+     * @param mainDataId 主表主键id
64
+     */
65
+    List<BusinessPgGopsPlanDetailVO> getPgGopsPlanDetailList(@Param("mainDataId")String mainDataId);
66
+
67
+    /**
68
+     * 库级购销计划从表详情
69
+     * @param ddcbid
70
+     * @return
71
+     */
72
+    BusinessPgGopsPlanDetailVO getPgGopsPlanDetail(@Param("ddcbid") String ddcbid);
73
+
74
+    void updatePgGopsPlanDetail(@Param("wcsl")BigDecimal wcsl, @Param("ddcbid")Integer ddcbid);
75
+
76
+    void updatePgGopsPlan(@Param("wcsl")BigDecimal wcsl, @Param("sjjlje")BigDecimal sjjlje, @Param("mainDataId")Integer mainDataId);
49 77
 }

+ 25 - 0
src/main/java/com/unis/crk/cplbusiness/service/IDataCrkywCpltzdxxDefaultService.java

@@ -4,6 +4,8 @@ import cn.hutool.json.JSONObject;
4 4
 import com.baomidou.mybatisplus.core.metadata.IPage;
5 5
 import com.baomidou.mybatisplus.extension.service.IService;
6 6
 import com.unis.crk.cplbusiness.entity.DataCrkywCpltzdxxDefault;
7
+import com.unis.crk.cplbusiness.entity.result.BusinessPgGopsPlanDetailVO;
8
+import com.unis.crk.cplbusiness.entity.result.BusinessPgGopsPlanVO;
7 9
 import com.unis.crk.cplbusiness.entity.vo.DataCrkywCplpfDefaultVo;
8 10
 import com.unis.crk.cplbusiness.entity.vo.DataCrkywCpltzdxxDefaultVo;
9 11
 
@@ -85,4 +87,27 @@ public interface IDataCrkywCpltzdxxDefaultService extends IService<DataCrkywCplt
85 87
         IPage<Map<String,Object>> findPagepfDefaultVo(DataCrkywCplpfDefaultVo pageQuery);
86 88
 
87 89
         Map<String,Object> getCplCrkTzdFltListAndsp(String mainDataId);
90
+
91
+        /**
92
+         * 通过单位Id及作业类型得到库级购销计划下拉列表
93
+         * @param unitId 单位id
94
+         * @param planType 计划类型,1:销售计划;2:收购计划
95
+         * @returnT
96
+         */
97
+        List<BusinessPgGopsPlanVO> getPgGopsPlanList(String unitId, String planType);
98
+        /**
99
+         * 库级购销计划详情:通过主表主键Id得到列表
100
+         * @param mainDataId 主表主键id
101
+         */
102
+        List<BusinessPgGopsPlanDetailVO> getPgGopsPlanDetailList(String mainDataId);
103
+
104
+        /**
105
+         * 库级购销计划:变更主从表完成数量
106
+         * @param ddcbid 购销计划从表id
107
+         * @param sjjlsl 重量
108
+         * @param sjjlje 金额
109
+         * @param spmc 商品名称
110
+         * @return
111
+         */
112
+        boolean updatePgGopsPlanQuantity(String ddcbid,Double sjjlsl,Double sjjlje,String spmc);
88 113
 }

+ 15 - 12
src/main/java/com/unis/crk/cplbusiness/service/impl/DataCrkywCplckFlt001ServiceImpl.java

@@ -72,12 +72,12 @@ public class DataCrkywCplckFlt001ServiceImpl extends ServiceImpl<DataCrkywCplckF
72 72
         }
73 73
         //性质默认值
74 74
         if(StrUtil.isBlank(flt001.getXz())){
75
-            flt001.setXz("952751");
75
+            flt001.setXz("6871");
76 76
         }
77 77
         //数量=件数*规格
78 78
         flt001.setSjjlsl(flt001.getJs()*Double.parseDouble(flt001.getGg()) );
79
-        //金额=数*单价
80
-        flt001.setJe(flt001.getSjjlsl()*flt001.getDj());
79
+        //金额=数*单价
80
+        flt001.setJe(flt001.getJs()*flt001.getDj());
81 81
         if (!super.saveOrUpdate(flt001)) { //
82 82
             throw new Exception(flt001.getSjjlspmc()+":保存成品粮入库从表失败");
83 83
         }
@@ -99,8 +99,9 @@ public class DataCrkywCplckFlt001ServiceImpl extends ServiceImpl<DataCrkywCplckF
99 99
 
100 100
         //更新通知单
101 101
         String ddcbid = flt001.getDdcbid();
102
-        if(!hasBlank(ddcbid)){
103
-            DataCrkywCpltzdxxFlt001 byId = dataCrkywCpltzdxxFlt001Service.getById(ddcbid);
102
+        if(!hasBlank(ddcbid)){ //更新购销计划数量
103
+            dataCrkywCpltzdxxDefaultService.updatePgGopsPlanQuantity(ddcbid,sjjlsl,flt001.getJe(),flt001.getSjjlspmc());
104
+          /*  DataCrkywCpltzdxxFlt001 byId = dataCrkywCpltzdxxFlt001Service.getById(ddcbid);
104 105
             if (byId != null) {
105 106
                 Double sysl = byId.getSysl();
106 107
                 Double wcsl = byId.getWcsl();
@@ -125,7 +126,7 @@ public class DataCrkywCplckFlt001ServiceImpl extends ServiceImpl<DataCrkywCplckF
125 126
                     }
126 127
                     dataCrkywCpltzdxxDefaultService.updateById(main);
127 128
                 }
128
-            }
129
+            }*/
129 130
         }
130 131
         jsonObject.set("success", true);
131 132
         jsonObject.set("msg", "保存成功");
@@ -166,8 +167,9 @@ public class DataCrkywCplckFlt001ServiceImpl extends ServiceImpl<DataCrkywCplckF
166 167
         }
167 168
 
168 169
         String ddcbid = flt001.getDdcbid();
169
-        if(!hasBlank(ddcbid)){
170
-            DataCrkywCpltzdxxFlt001 byId = dataCrkywCpltzdxxFlt001Service.getById(ddcbid);
170
+        if(!hasBlank(ddcbid)){ //更新购销计划数量
171
+            dataCrkywCpltzdxxDefaultService.updatePgGopsPlanQuantity(ddcbid,editZl,0.0,flt001.getSjjlspmc());
172
+           /* DataCrkywCpltzdxxFlt001 byId = dataCrkywCpltzdxxFlt001Service.getById(ddcbid);
171 173
             if (byId != null){
172 174
                 Double sysl = byId.getSysl();
173 175
                 Double wcsl = byId.getWcsl();
@@ -190,7 +192,7 @@ public class DataCrkywCplckFlt001ServiceImpl extends ServiceImpl<DataCrkywCplckF
190 192
                     }
191 193
                     dataCrkywCpltzdxxDefaultService.updateById(main);
192 194
                 }
193
-            }
195
+            }*/
194 196
         }
195 197
         jsonObject.set("success", true);
196 198
         jsonObject.set("msg", "修改成功");
@@ -229,8 +231,9 @@ public class DataCrkywCplckFlt001ServiceImpl extends ServiceImpl<DataCrkywCplckF
229 231
             jsonObject.set("msg", entity.getSjjlspmc()+":删除仓储数据失败");
230 232
             throw new RuntimeException(entity.getSjjlspmc()+":删除仓储数据失败");
231 233
         }
232
-        if(!hasBlank(ddcbid)){
233
-            DataCrkywCpltzdxxFlt001 byId = dataCrkywCpltzdxxFlt001Service.getById(ddcbid);
234
+        if(!hasBlank(ddcbid)){ //更新购销计划数量
235
+            dataCrkywCpltzdxxDefaultService.updatePgGopsPlanQuantity(ddcbid,sjjlsl*-1,entity.getJe()*-1,entity.getSjjlspmc());
236
+           /* DataCrkywCpltzdxxFlt001 byId = dataCrkywCpltzdxxFlt001Service.getById(ddcbid);
234 237
             if (byId != null){
235 238
                 Double sysl = byId.getSysl();
236 239
                 Double wcsl = byId.getWcsl();
@@ -250,7 +253,7 @@ public class DataCrkywCplckFlt001ServiceImpl extends ServiceImpl<DataCrkywCplckF
250 253
                     }
251 254
                     dataCrkywCpltzdxxDefaultService.updateById(main);
252 255
                 }
253
-            }
256
+            }*/
254 257
         }
255 258
         jsonObject.set("success", true);
256 259
         jsonObject.set("msg", "删除成功");

+ 2 - 2
src/main/java/com/unis/crk/cplbusiness/service/impl/DataCrkywCplfjDefaultServiceImpl.java

@@ -73,7 +73,7 @@ public class DataCrkywCplfjDefaultServiceImpl extends ServiceImpl<DataCrkywCplfj
73 73
             flt001.setUnitid(unitId);// 设置单位id
74 74
             //性质默认值
75 75
             if(StrUtil.isBlank(flt001.getXz())){
76
-                flt001.setXz("952751");
76
+                flt001.setXz("6871");
77 77
             }
78 78
             //数量=件数*规格
79 79
             flt001.setSjjlsl(flt001.getJs()*Double.parseDouble(flt001.getGg()) );
@@ -142,7 +142,7 @@ public class DataCrkywCplfjDefaultServiceImpl extends ServiceImpl<DataCrkywCplfj
142 142
                 flt001.setUnitid(param.getUnitid());//
143 143
                 //性质默认值
144 144
                 if(StrUtil.isBlank(flt001.getXz())){
145
-                    flt001.setXz("952751");
145
+                    flt001.setXz("6871");
146 146
                 }
147 147
                 //数量=件数*规格
148 148
                 flt001.setSjjlsl(flt001.getJs()*Double.parseDouble(flt001.getGg()) );

+ 91 - 86
src/main/java/com/unis/crk/cplbusiness/service/impl/DataCrkywCplrkDefaultServiceImpl.java

@@ -88,24 +88,24 @@ public class DataCrkywCplrkDefaultServiceImpl extends ServiceImpl<DataCrkywCplrk
88 88
             dataId=s;
89 89
             param.setDataId(s);
90 90
         }
91
-        //非暂存保存结算数据
91
+        //青海无此业务 非暂存保存结算数据
92 92
         if(!"0".equals(param.getIsstaging())){
93
-            SettlementManagement settlementManagement = new SettlementManagement();
94
-            settlementManagement.setReceiptDocNo(param.getRkbh());//入库编号
95
-            settlementManagement.setOrderNo(param.getDdbh());//订单编号
96
-            settlementManagement.setSupplierName(param.getGys());
97
-            settlementManagement.setTradeName(param.getSjjlspmc());
98
-            settlementManagement.setUnitid(unitId);
99
-            settlementManagement.setBuilderDate(new Date());
100
-            settlementManagement.setBuilder("系统自动生成");
101
-            settlementManagement.setWarehousingTime(param.getYwsj());
102
-            settlementManagement.setAuditStatus("0");
103
-            settlementManagementService.save(settlementManagement);
93
+//            SettlementManagement settlementManagement = new SettlementManagement();
94
+//            settlementManagement.setReceiptDocNo(param.getRkbh());//入库编号
95
+//            settlementManagement.setOrderNo(param.getDdbh());//订单编号
96
+//            settlementManagement.setSupplierName(param.getGys());
97
+//            settlementManagement.setTradeName(param.getSjjlspmc());
98
+//            settlementManagement.setUnitid(unitId);
99
+//            settlementManagement.setBuilderDate(new Date());
100
+//            settlementManagement.setBuilder("系统自动生成");
101
+//            settlementManagement.setWarehousingTime(param.getYwsj());
102
+//            settlementManagement.setAuditStatus("0");
103
+//            settlementManagementService.save(settlementManagement);
104 104
         }
105 105
         //得到从表数据
106 106
         List<DataCrkywCplrkFlt001> flt001s = param.getFltList();
107 107
         if (flt001s == null || flt001s.size() <= 0){
108
-            throw new Exception("成品粮入库商品信息为空失败");
108
+            throw new Exception("成品粮入库商品信息不能为空");
109 109
         }
110 110
         String spmc = "";
111 111
         for (int i = 0; i < flt001s.size(); i++) {
@@ -113,25 +113,27 @@ public class DataCrkywCplrkDefaultServiceImpl extends ServiceImpl<DataCrkywCplrk
113 113
             DataCrkywCplrkFlt001 flt001 = flt001s.get(i);
114 114
             flt001.setMainDataId(dataId);// 设置主表ID
115 115
             flt001.setUnitid(unitId);// 设置单位id
116
-            SysParams byId = sysParamsService.getById("sy.url");
117
-            String paramVal = byId.getParamVal();
118
-            String syurl=paramVal+"/"+unitId+"/"+param.getCh()+"/"+param.getHwh()+"/"+flt001.getSjjlspmcbh()+"/"+param.getRkbh()+"/"+flt001.getScpc();
119
-            flt001.setSyurl(syurl);
116
+            //青海无溯源业务
117
+//            SysParams byId = sysParamsService.getById("sy.url");
118
+//            String paramVal = byId.getParamVal();
119
+//            String syurl=paramVal+"/"+unitId+"/"+param.getCh()+"/"+param.getHwh()+"/"+flt001.getSjjlspmcbh()+"/"+param.getRkbh()+"/"+flt001.getScpc();
120
+//            flt001.setSyurl(syurl);
120 121
             //非暂存保存入库数据和评分数据
121 122
             if(!"0".equals(param.getIsstaging())) {
122 123
                 spmc += flt001.getSjjlspmc() + ",";
123 124
                 flt001.setIsstaging("1");
124 125
                 //有订单时,自动新增评分数据
125 126
                 if (StrUtil.isNotBlank(param.getDdbh())) {
126
-                    DataCrkywCplpfDefault dataCrkywCplpfDefault = new DataCrkywCplpfDefault();
127
-                    dataCrkywCplpfDefault.setScpc(flt001.getScpc());
128
-                    dataCrkywCplpfDefault.setSjjlspmcbh(flt001.getSjjlspmcbh());
129
-                    dataCrkywCplpfDefault.setTzdbm(param.getDdbh());
130
-                    dataCrkywCplpfDefault.setUnitid(param.getUnitid());
131
-                    dataCrkywCplpfDefault.setCjsj(param.getCjsj());
132
-                    dataCrkywCplpfDefault.setRkbh(param.getRkbh());
133
-                    dataCrkywCplpfDefault.setRksj(param.getYwsj());
134
-                    dataCrkywCplpfDefaultService.save(dataCrkywCplpfDefault);
127
+                    //青海无此业务
128
+//                    DataCrkywCplpfDefault dataCrkywCplpfDefault = new DataCrkywCplpfDefault();
129
+//                    dataCrkywCplpfDefault.setScpc(flt001.getScpc());
130
+//                    dataCrkywCplpfDefault.setSjjlspmcbh(flt001.getSjjlspmcbh());
131
+//                    dataCrkywCplpfDefault.setTzdbm(param.getDdbh());
132
+//                    dataCrkywCplpfDefault.setUnitid(param.getUnitid());
133
+//                    dataCrkywCplpfDefault.setCjsj(param.getCjsj());
134
+//                    dataCrkywCplpfDefault.setRkbh(param.getRkbh());
135
+//                    dataCrkywCplpfDefault.setRksj(param.getYwsj());
136
+//                    dataCrkywCplpfDefaultService.save(dataCrkywCplpfDefault);
135 137
                     dataCrkywCplrkFlt001Service.saveFlt(flt001);
136 138
                 }
137 139
             }else{ //暂存只保存数据,不涉及业务
@@ -174,31 +176,33 @@ public class DataCrkywCplrkDefaultServiceImpl extends ServiceImpl<DataCrkywCplrk
174 176
         QueryWrapper<DataCrkywCplrkFlt001> Wrapper = new QueryWrapper<>();
175 177
         Wrapper.eq("MainDataID", param.getDataId());
176 178
         List<DataCrkywCplrkFlt001> oldFlt001s = dataCrkywCplrkFlt001Service.list(Wrapper);
177
-        //得到结算数据并修改结算数据
178
-        QueryWrapper<SettlementManagement> settlementQueryWrapper = new QueryWrapper<>();
179
-        Wrapper.eq("receipt_doc_no", param.getRkbh());
180
-        List<SettlementManagement> list = settlementManagementService.list(settlementQueryWrapper);
181
-        if(list.size()>0 && "1".equals(param.getIsstaging())){ //非暂存时修改结算数据
182
-            SettlementManagement settlementManagement = list.get(0);
183
-            settlementManagement.setReceiptDocNo(param.getRkbh());//入库编号
184
-            settlementManagement.setOrderNo(param.getDdbh());//订单编号
185
-            settlementManagement.setSupplierName(param.getGys());
186
-            settlementManagement.setTradeName(param.getSjjlspmc());
187
-            settlementManagement.setUpdateTime(new Date());
188
-            settlementManagement.setWarehousingTime(param.getYwsj());
189
-            settlementManagement.setAuditStatus("0");
190
-            settlementManagementService.update(settlementManagement);
191
-        }
179
+        //青海无此业务 得到结算数据并修改结算数据
180
+//        QueryWrapper<SettlementManagement> settlementQueryWrapper = new QueryWrapper<>();
181
+//        Wrapper.eq("receipt_doc_no", param.getRkbh());
182
+//        List<SettlementManagement> list = settlementManagementService.list(settlementQueryWrapper);
183
+//        if(list.size()>0 && "1".equals(param.getIsstaging())){ //非暂存时修改结算数据
184
+//            SettlementManagement settlementManagement = list.get(0);
185
+//            settlementManagement.setReceiptDocNo(param.getRkbh());//入库编号
186
+//            settlementManagement.setOrderNo(param.getDdbh());//订单编号
187
+//            settlementManagement.setSupplierName(param.getGys());
188
+//            settlementManagement.setTradeName(param.getSjjlspmc());
189
+//            settlementManagement.setUpdateTime(new Date());
190
+//            settlementManagement.setWarehousingTime(param.getYwsj());
191
+//            settlementManagement.setAuditStatus("0");
192
+//            settlementManagementService.update(settlementManagement);
193
+//        }
192 194
         String isstaging = param.getIsstaging();
193 195
 
194 196
         List<DataCrkywCplrkFlt001> newFlt001s = param.getFltList();
195 197
         String spmcz = "";
196 198
         for (int j = 0; j < newFlt001s.size(); j++) {
197 199
             DataCrkywCplrkFlt001 newFlt001 = newFlt001s.get(j);
198
-            SysParams byId = sysParamsService.getById("sy.url");
199
-            String syurl=byId+"/"+param.getUnitid()+"/"+param.getCh()+"/"+param.getHwh()+"/"+newFlt001.getSjjlspmcbh()+"/"+param.getRkbh()+"/"+newFlt001.getScpc();
200
+            //溯源地址,青海 无此业务
201
+//            SysParams byId = sysParamsService.getById("sy.url");
202
+//            String syurl=byId+"/"+param.getUnitid()+"/"+param.getCh()+"/"+param.getHwh()+"/"+newFlt001.getSjjlspmcbh()+"/"+param.getRkbh()+"/"+newFlt001.getScpc();
203
+//            newFlt001.setSyurl(syurl);
204
+
200 205
             spmcz += newFlt001.getSjjlspmc() + ",";
201
-            newFlt001.setSyurl(syurl);
202 206
             if (StrUtil.isBlank(newFlt001.getDataId())){ //新增
203 207
                 insertFlt.add(newFlt001);
204 208
             }
@@ -227,18 +231,18 @@ public class DataCrkywCplrkDefaultServiceImpl extends ServiceImpl<DataCrkywCplrk
227 231
             QueryWrapper<DataCrkywCplrkFlt001> wrapper = new QueryWrapper<>();
228 232
             wrapper.eq("MainDataID", param.getDataId());
229 233
             dataCrkywCplrkFlt001Service.remove(wrapper);
230
-            //结算数据
231
-            SettlementManagement settlementManagement = new SettlementManagement();
232
-            settlementManagement.setReceiptDocNo(param.getRkbh());//入库编号
233
-            settlementManagement.setOrderNo(param.getDdbh());//订单编号
234
-            settlementManagement.setSupplierName(param.getGys());
235
-            settlementManagement.setTradeName(param.getSjjlspmc());
236
-            settlementManagement.setUnitid(unitId);
237
-            settlementManagement.setBuilderDate(new Date());
238
-            settlementManagement.setBuilder("系统自动生成");
239
-            settlementManagement.setWarehousingTime(param.getYwsj());
240
-            settlementManagement.setAuditStatus("0");
241
-            settlementManagementService.save(settlementManagement);
234
+            //青海无此业务 结算数据
235
+//            SettlementManagement settlementManagement = new SettlementManagement();
236
+//            settlementManagement.setReceiptDocNo(param.getRkbh());//入库编号
237
+//            settlementManagement.setOrderNo(param.getDdbh());//订单编号
238
+//            settlementManagement.setSupplierName(param.getGys());
239
+//            settlementManagement.setTradeName(param.getSjjlspmc());
240
+//            settlementManagement.setUnitid(unitId);
241
+//            settlementManagement.setBuilderDate(new Date());
242
+//            settlementManagement.setBuilder("系统自动生成");
243
+//            settlementManagement.setWarehousingTime(param.getYwsj());
244
+//            settlementManagement.setAuditStatus("0");
245
+//            settlementManagementService.save(settlementManagement);
242 246
 
243 247
             //新增保存入库子表数据
244 248
             String spmc = "";
@@ -247,26 +251,27 @@ public class DataCrkywCplrkDefaultServiceImpl extends ServiceImpl<DataCrkywCplrk
247 251
                 DataCrkywCplrkFlt001 flt001 =  param.getFltList().get(i);
248 252
                 flt001.setMainDataId(dataId);// 设置主表ID
249 253
                 flt001.setUnitid(unitId);// 设置单位id
250
-                SysParams byId = sysParamsService.getById("sy.url");
251
-                String paramVal = byId.getParamVal();
252
-                String syurl=paramVal+"/"+unitId+"/"+param.getCh()+"/"+param.getHwh()+"/"+flt001.getSjjlspmcbh()+"/"+param.getRkbh()+"/"+flt001.getScpc();
253
-                flt001.setSyurl(syurl);
254
+                //青海无此业务
255
+//                SysParams byId = sysParamsService.getById("sy.url");
256
+//                String paramVal = byId.getParamVal();
257
+//                String syurl=paramVal+"/"+unitId+"/"+param.getCh()+"/"+param.getHwh()+"/"+flt001.getSjjlspmcbh()+"/"+param.getRkbh()+"/"+flt001.getScpc();
258
+//                flt001.setSyurl(syurl);
254 259
                 //非暂存保存入库数据和评分数据
255 260
                     spmc += flt001.getSjjlspmc() + ",";
256 261
                     flt001.setIsstaging("1");
257
-                    //有订单时,自动新增评分数据
258
-                    if (StrUtil.isNotBlank(param.getDdbh())) {
259
-                        DataCrkywCplpfDefault dataCrkywCplpfDefault = new DataCrkywCplpfDefault();
260
-                        dataCrkywCplpfDefault.setScpc(flt001.getScpc());
261
-                        dataCrkywCplpfDefault.setSjjlspmcbh(flt001.getSjjlspmcbh());
262
-                        dataCrkywCplpfDefault.setTzdbm(param.getDdbh());
263
-                        dataCrkywCplpfDefault.setUnitid(param.getUnitid());
264
-                        dataCrkywCplpfDefault.setCjsj(param.getCjsj());
265
-                        dataCrkywCplpfDefault.setRkbh(param.getRkbh());
266
-                        dataCrkywCplpfDefault.setRksj(param.getYwsj());
267
-                        dataCrkywCplpfDefaultService.save(dataCrkywCplpfDefault);
268
-                        dataCrkywCplrkFlt001Service.saveFlt(flt001);
269
-                    }
262
+//                    //有订单时,自动新增评分数据 青海无此业务
263
+//                    if (StrUtil.isNotBlank(param.getDdbh())) {
264
+//                        DataCrkywCplpfDefault dataCrkywCplpfDefault = new DataCrkywCplpfDefault();
265
+//                        dataCrkywCplpfDefault.setScpc(flt001.getScpc());
266
+//                        dataCrkywCplpfDefault.setSjjlspmcbh(flt001.getSjjlspmcbh());
267
+//                        dataCrkywCplpfDefault.setTzdbm(param.getDdbh());
268
+//                        dataCrkywCplpfDefault.setUnitid(param.getUnitid());
269
+//                        dataCrkywCplpfDefault.setCjsj(param.getCjsj());
270
+//                        dataCrkywCplpfDefault.setRkbh(param.getRkbh());
271
+//                        dataCrkywCplpfDefault.setRksj(param.getYwsj());
272
+//                        dataCrkywCplpfDefaultService.save(dataCrkywCplpfDefault);
273
+//                    }
274
+                dataCrkywCplrkFlt001Service.saveFlt(flt001);
270 275
             }
271 276
             param.setSjjlspmc(spmc.substring(0,spmc.length()-1));
272 277
             if (!super.saveOrUpdate(param)) { //
@@ -366,19 +371,19 @@ public class DataCrkywCplrkDefaultServiceImpl extends ServiceImpl<DataCrkywCplrk
366 371
                 //保存从表数据,有错误抛异常
367 372
                 DataCrkywCplrkFlt001 flt001 = flt001s.get(i);
368 373
                 dataCrkywCplrkFlt001Service.deleteFlt(flt001.getDataId());
369
-                //删除评分
370
-                QueryWrapper<DataCrkywCplpfDefault> dataCrkywCplpfDefault = new QueryWrapper<>();
371
-                dataCrkywCplpfDefault.eq("cjsj",entity.getCjsj());
372
-                dataCrkywCplpfDefault.eq("scpc",flt001.getScpc());
373
-                List<DataCrkywCplpfDefault> list1 = dataCrkywCplpfDefaultService.list(dataCrkywCplpfDefault);
374
-                if(list1.size()>0){
375
-                    Iterator<DataCrkywCplpfDefault> iterator = list1.iterator();
376
-                    while (iterator.hasNext()){
377
-                        DataCrkywCplpfDefault next = iterator.next();
378
-                        dataCrkywCplpfDefaultService.delete(next.getDataId());
379
-                        deleteDataRecordService.save(next.getDataId(),"data_crkyw_cplpf_default",next.getUnitid(),new Date());
380
-                    }
381
-                }
374
+                //青海无此业务 删除评分
375
+//                QueryWrapper<DataCrkywCplpfDefault> dataCrkywCplpfDefault = new QueryWrapper<>();
376
+//                dataCrkywCplpfDefault.eq("cjsj",entity.getCjsj());
377
+//                dataCrkywCplpfDefault.eq("scpc",flt001.getScpc());
378
+//                List<DataCrkywCplpfDefault> list1 = dataCrkywCplpfDefaultService.list(dataCrkywCplpfDefault);
379
+//                if(list1.size()>0){
380
+//                    Iterator<DataCrkywCplpfDefault> iterator = list1.iterator();
381
+//                    while (iterator.hasNext()){
382
+//                        DataCrkywCplpfDefault next = iterator.next();
383
+//                        dataCrkywCplpfDefaultService.delete(next.getDataId());
384
+//                        deleteDataRecordService.save(next.getDataId(),"data_crkyw_cplpf_default",next.getUnitid(),new Date());
385
+//                    }
386
+//                }
382 387
             }
383 388
         }
384 389
         jsonObject.set("success", true);

+ 12 - 35
src/main/java/com/unis/crk/cplbusiness/service/impl/DataCrkywCplrkFlt001ServiceImpl.java

@@ -64,12 +64,12 @@ public class DataCrkywCplrkFlt001ServiceImpl extends ServiceImpl<DataCrkywCplrkF
64 64
             }
65 65
             //性质默认值
66 66
         if(StrUtil.isBlank(flt001.getXz())){
67
-            flt001.setXz("952751");
67
+            flt001.setXz("6871");
68 68
         }
69 69
             //数量=件数*规格
70 70
         flt001.setSjjlsl(flt001.getJs()*Double.parseDouble(flt001.getGg()) );
71
-            //金额=数*单价
72
-        flt001.setJe(flt001.getSjjlsl()*flt001.getDj());
71
+            //金额=数*单价
72
+        flt001.setJe(flt001.getJs()*flt001.getDj());
73 73
             if (!super.saveOrUpdate(flt001)) { //
74 74
                 throw new Exception(flt001.getSjjlspmc()+":保存成品粮入库从表失败");
75 75
             }
@@ -88,33 +88,7 @@ public class DataCrkywCplrkFlt001ServiceImpl extends ServiceImpl<DataCrkywCplrkF
88 88
             //更新通知单
89 89
             String ddcbid = flt001.getDdcbid();
90 90
             if(!hasBlank(ddcbid)){
91
-                DataCrkywCpltzdxxFlt001 byId = dataCrkywCpltzdxxFlt001Service.getById(ddcbid);
92
-                if (byId != null) {
93
-                    Double wcsl = byId.getWcsl();
94
-                    Double sysl = byId.getSysl();
95
-                    if (sysl - sjjlsl < 0) {
96
-                        jsonObject.set("msg", flt001.getSjjlspmc() + ":入库数量大于订单数量");
97
-                        throw new RuntimeException(flt001.getSjjlspmc() + ":入库数量大于订单数量");
98
-//                return jsonObject;
99
-                    }
100
-
101
-                    byId.setWcsl(wcsl + sjjlsl);//订单从表完成数量增加
102
-                    byId.setSysl(sysl - sjjlsl);//修改订单从平剩余数量
103
-                    dataCrkywCpltzdxxFlt001Service.updateById(byId);
104
-                    //更新主表数量
105
-                    String mainDataId = byId.getMainDataID();
106
-                    DataCrkywCpltzdxxDefault main = dataCrkywCpltzdxxDefaultService.getById(mainDataId);
107
-                    if (main != null){
108
-                        main.setWcsl(main.getWcsl() + sjjlsl);//订单主表完成数量增加
109
-                        main.setSysl(main.getSysl() - sjjlsl);//订单主表剩余数量
110
-                        if(main.getSysl()==0){
111
-                            main.setTsdzt("04");
112
-                        }else{
113
-                            main.setTsdzt("03");
114
-                        }
115
-                        dataCrkywCpltzdxxDefaultService.updateById(main);
116
-                    }
117
-                }
91
+                dataCrkywCpltzdxxDefaultService.updatePgGopsPlanQuantity(ddcbid,flt001.getSjjlsl(),flt001.getJe(),flt001.getSjjlspmc());
118 92
             }
119 93
             jsonObject.set("success", true);
120 94
             jsonObject.set("msg", "保存成功");
@@ -152,7 +126,9 @@ public class DataCrkywCplrkFlt001ServiceImpl extends ServiceImpl<DataCrkywCplrkF
152 126
         }
153 127
 
154 128
         String ddcbid = flt001.getDdcbid();
155
-        if(!hasBlank(ddcbid)){
129
+        if(!hasBlank(ddcbid)){ //更新购销计划数量
130
+            dataCrkywCpltzdxxDefaultService.updatePgGopsPlanQuantity(ddcbid,editZl,0.0,flt001.getSjjlspmc());
131
+           /*
156 132
             DataCrkywCpltzdxxFlt001 byId = dataCrkywCpltzdxxFlt001Service.getById(ddcbid);
157 133
             if (byId != null){
158 134
                 Double wcsl = byId.getWcsl();
@@ -178,7 +154,7 @@ public class DataCrkywCplrkFlt001ServiceImpl extends ServiceImpl<DataCrkywCplrkF
178 154
                     }
179 155
                     dataCrkywCpltzdxxDefaultService.updateById(main);
180 156
                 }
181
-            }
157
+            }*/
182 158
         }
183 159
         jsonObject.set("success", true);
184 160
         jsonObject.set("msg", "修改成功");
@@ -217,8 +193,9 @@ public class DataCrkywCplrkFlt001ServiceImpl extends ServiceImpl<DataCrkywCplrkF
217 193
         }
218 194
         String ddcbid = entity.getDdcbid();
219 195
         Double sjjlsl = entity.getSjjlsl();
220
-        if(!hasBlank(ddcbid)){
221
-            DataCrkywCpltzdxxFlt001 byId = dataCrkywCpltzdxxFlt001Service.getById(ddcbid);
196
+        if(!hasBlank(ddcbid)){ //更新购销计划数量
197
+            dataCrkywCpltzdxxDefaultService.updatePgGopsPlanQuantity(ddcbid,sjjlsl*-1,entity.getJe()*-1,entity.getSjjlspmc());
198
+           /* DataCrkywCpltzdxxFlt001 byId = dataCrkywCpltzdxxFlt001Service.getById(ddcbid);
222 199
             if (byId != null){
223 200
                 Double wcsl = byId.getWcsl();
224 201
                 Double sysl = byId.getSysl();
@@ -238,7 +215,7 @@ public class DataCrkywCplrkFlt001ServiceImpl extends ServiceImpl<DataCrkywCplrkF
238 215
                     }
239 216
                     dataCrkywCpltzdxxDefaultService.updateById(main);
240 217
                 }
241
-            }
218
+            }*/
242 219
         }
243 220
         jsonObject.set("success", true);
244 221
         jsonObject.set("msg", "删除成功");

+ 54 - 0
src/main/java/com/unis/crk/cplbusiness/service/impl/DataCrkywCpltzdxxDefaultServiceImpl.java

@@ -1,5 +1,6 @@
1 1
 package com.unis.crk.cplbusiness.service.impl;
2 2
 
3
+import cn.hutool.core.util.NumberUtil;
3 4
 import cn.hutool.core.util.StrUtil;
4 5
 import cn.hutool.json.JSONObject;
5 6
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -10,6 +11,8 @@ import com.unis.crk.business.qcrk.entity.DataCrkywTzdxxDefault;
10 11
 import com.unis.crk.business.qcrk.entity.DataCrkywTzdxxFlt001;
11 12
 import com.unis.crk.common.service.IDeleteDataRecordService;
12 13
 import com.unis.crk.cplbusiness.entity.*;
14
+import com.unis.crk.cplbusiness.entity.result.BusinessPgGopsPlanDetailVO;
15
+import com.unis.crk.cplbusiness.entity.result.BusinessPgGopsPlanVO;
13 16
 import com.unis.crk.cplbusiness.entity.vo.DataCrkywCplpfDefaultVo;
14 17
 import com.unis.crk.cplbusiness.entity.vo.DataCrkywCpltzdxxDefaultVo;
15 18
 import com.unis.crk.cplbusiness.mapper.DataCrkywCpltzdxxDefaultMapper;
@@ -24,6 +27,7 @@ import org.springframework.transaction.annotation.Transactional;
24 27
 import sun.rmi.server.WeakClassHashMap;
25 28
 
26 29
 import javax.annotation.Resource;
30
+import java.math.BigDecimal;
27 31
 import java.util.*;
28 32
 
29 33
 /**
@@ -266,6 +270,56 @@ public class DataCrkywCpltzdxxDefaultServiceImpl extends ServiceImpl<DataCrkywCp
266 270
         return stringObjectHashMap;
267 271
     }
268 272
 
273
+    /**
274
+     * 通过单位Id及作业类型得到库级购销计划下拉列表
275
+     *
276
+     * @param unitId   单位id
277
+     * @param planType 计划类型,1:销售计划;2:收购计划
278
+     * @returnT
279
+     */
280
+    @Override
281
+    public List<BusinessPgGopsPlanVO> getPgGopsPlanList(String unitId, String planType) {
282
+        return dataCrkywCpltzdxxDefaultMapper.getPgGopsPlanList(unitId,planType);
283
+    }
284
+
285
+    /**
286
+     * 库级购销计划详情:通过主表主键Id得到列表
287
+     *
288
+     * @param mainDataId 主表主键id
289
+     */
290
+    @Override
291
+    public List<BusinessPgGopsPlanDetailVO> getPgGopsPlanDetailList(String mainDataId) {
292
+        return dataCrkywCpltzdxxDefaultMapper.getPgGopsPlanDetailList(mainDataId);
293
+    }
294
+
295
+    /**
296
+     * 库级购销计划:变更主从表完成数量
297
+     *
298
+     * @param ddcbid
299
+     * @return
300
+     */
301
+    @Override
302
+    public boolean updatePgGopsPlanQuantity(String ddcbid,Double sjjlsl,Double sjjlje,String spmc) {
303
+        BusinessPgGopsPlanDetailVO byId = dataCrkywCpltzdxxDefaultMapper.getPgGopsPlanDetail(ddcbid);
304
+
305
+        if (byId != null) {
306
+            BigDecimal wcsl = byId.getWcsl();
307
+            BigDecimal sysl = byId.getSysl();
308
+            BigDecimal sjjlsl_ = NumberUtil.toBigDecimal(sjjlsl);
309
+            BigDecimal sjjlje_ = NumberUtil.toBigDecimal(sjjlje);
310
+            if (NumberUtil.sub(sysl,sjjlsl_).doubleValue() < 0.0) {
311
+                throw new RuntimeException(spmc + ":数量大于购销计划数量");
312
+//                return jsonObject;
313
+            }
314
+            wcsl = NumberUtil.add(wcsl,sjjlsl_); //计算完成数量
315
+            dataCrkywCpltzdxxDefaultMapper.updatePgGopsPlanDetail(wcsl,byId.getDdcbid());
316
+            //更新主表数量
317
+            Integer mainDataId = byId.getPlanId();
318
+            dataCrkywCpltzdxxDefaultMapper.updatePgGopsPlan(wcsl,sjjlje_,mainDataId);
319
+        }
320
+        return true;
321
+    }
322
+
269 323
 
270 324
     @Override
271 325
     public List<Map<String,Object>> getCplCrkTzdList(String unitId, String zylx){

+ 2 - 2
src/main/java/com/unis/crk/cplbusiness/service/impl/DataKcglCplkcbdDefaultServiceImpl.java

@@ -128,7 +128,7 @@ public class DataKcglCplkcbdDefaultServiceImpl extends ServiceImpl<DataKcglCplkc
128 128
             next.setBdfs(StoreWorkType.KcbdPc.toString());
129 129
             //next.setYwsj(new Date());
130 130
             if (StrUtil.isBlank(next.getXz())){
131
-                next.setXz("952751"); //默认值
131
+                next.setXz("6871"); //默认值
132 132
             }
133 133
 
134 134
                 if(!this.saveOrUpdate(next)){
@@ -227,7 +227,7 @@ public class DataKcglCplkcbdDefaultServiceImpl extends ServiceImpl<DataKcglCplkc
227 227
             String yrhwh = next.getYrhwh();
228 228
             next.setBdfs(StoreWorkType.KcbdYc.toString());
229 229
             if (StrUtil.isBlank(next.getXz())){
230
-                next.setXz("952751"); //默认值
230
+                next.setXz("6871"); //默认值
231 231
             }
232 232
             next.setBdhjs(next.getBdhsl()/Double.parseDouble(next.getGg()));
233 233
             //查询调入库存信息,并为调拨数据赋值

+ 2 - 2
src/main/java/com/unis/crk/cplbusiness/service/impl/DataKcglCplqckcDefaultServiceImpl.java

@@ -66,7 +66,7 @@ public class DataKcglCplqckcDefaultServiceImpl extends ServiceImpl<DataKcglCplqc
66 66
                 qckc.setEditor(qckc.getUnitid());
67 67
             }
68 68
             if (StrUtil.isBlank(qckc.getXz())){
69
-                qckc.setXz("952751"); //默认值
69
+                qckc.setXz("6871"); //默认值
70 70
             }
71 71
             //保存数据
72 72
             if (!super.saveOrUpdate(qckc)){
@@ -97,7 +97,7 @@ public class DataKcglCplqckcDefaultServiceImpl extends ServiceImpl<DataKcglCplqc
97 97
         JSONObject jsonObject = new JSONObject();
98 98
         jsonObject.set("success",false);
99 99
         if (StrUtil.isBlank(qckc.getXz())){
100
-            qckc.setXz("952751"); //默认值
100
+            qckc.setXz("6871"); //默认值
101 101
         }
102 102
         //保存数据
103 103
         if (!super.saveOrUpdate(qckc)){

+ 1 - 1
src/main/java/com/unis/crk/cplbusiness/service/impl/LiAfterSaleServiceImpl.java

@@ -94,7 +94,7 @@ public class LiAfterSaleServiceImpl extends ServiceImpl<LiAfterSaleMapper, LiAft
94 94
             dataCrkywCplrkFlt001.setMainDataId(dataid);
95 95
             dataCrkywCplrkFlt001.setUnitid(dataCrkywCplrkDefault.getUnitid());
96 96
             dataCrkywCplrkFlt001.setDataId(byId.getId());
97
-            dataCrkywCplrkFlt001.setXz("952751");
97
+            dataCrkywCplrkFlt001.setXz("6871");
98 98
             dataCrkywCplrkFlt001.setUnitid(dataCrkywCplrkDefault.getUnitid());
99 99
             dataCrkywCplrkFlt001s.add(dataCrkywCplrkFlt001);
100 100
             dataCrkywCplrkDefault.setFltList(dataCrkywCplrkFlt001s);

+ 1 - 1
src/main/java/com/unis/crk/cplbusiness/service/impl/LiOrderServiceImpl.java

@@ -157,7 +157,7 @@ public class LiOrderServiceImpl extends ServiceImpl<LiOrderMapper, LiOrder> impl
157 157
                 dataCrkywCplckFlt001.setMainDataId(liOrderItem.getId());
158 158
                 dataCrkywCplckFlt001.setDj(liOrderItem.getUnitPrice().doubleValue());
159 159
                 dataCrkywCplckFlt001.setUnitid(byId.getUnitid());
160
-                dataCrkywCplckFlt001.setXz("952751");
160
+                dataCrkywCplckFlt001.setXz("6871");
161 161
                 dataCrkywCplckFlt001s.add(dataCrkywCplckFlt001);
162 162
                 dataCrkywCplckDefault.setFltList(dataCrkywCplckFlt001s);
163 163
                 dataCrkywCplckDefaults.add(dataCrkywCplckDefault);

+ 100 - 0
src/main/resources/mapper/cplbusiness/DataCrkywCpltzdxxDefaultMapper.xml

@@ -213,5 +213,105 @@
213 213
         </if>
214 214
         order  by  a.BuildDate desc
215 215
     </select>
216
+    <select id="getPgGopsPlanList" resultType="com.unis.crk.cplbusiness.entity.result.BusinessPgGopsPlanVO">
217
+        SELECT
218
+        a.id as "DataID",
219
+        GROUP_CONCAT(c.sjjlspmc) as 'mxpzValue',
220
+        '' as  "kfbh",
221
+        a.org_id as "orgId",
222
+        a.updatedate as "ModifyDate",
223
+        a.plan_code as "tzdbm",
224
+        a.plan_name as "jhdmc",
225
+        '' as  "htmc",
226
+        a.plan_type "cazylx",
227
+        case WHEN a.plan_type = 1 then  '销售计划' else '收购计划' END as "cazylxmc",
228
+        a.customer_name as "kfmc",
229
+        a.plan_quantity as "sl",
230
+        a.completion_quantity as  "wcsl",
231
+        a.plan_quantity-a.completion_quantity as "sysl",
232
+        case WHEN a.plan_type = 1 then  '284344D15DCA72D90AA43C24BD4F9B47' else '420801654D8F01A7D9FCE01B90A395E6' END as "flowId"
233
+        FROM business_pg_gops_plan a
234
+        LEFT JOIN business_pg_gops_plan_detail b on a.id = b.pg_gops_plan_id
235
+        LEFT JOIN data_crkyw_cplsp_default c on b.crkyw_cplsp_default_id = c.dataId
236
+        WHERE
237
+        a.org_id = #{unitId}
238
+        <if test='planType != null and planType != ""'>
239
+            AND a.plan_type IN (${planType})
240
+        </if>
241
+        AND a.plan_quantity-a.completion_quantity > 0
242
+        GROUP BY a.id
243
+        ORDER BY a.updatedate DESC
244
+    </select>
245
+    <select id="getPgGopsPlanDetailList" resultType="com.unis.crk.cplbusiness.entity.result.BusinessPgGopsPlanDetailVO">
246
+         SELECT DISTINCT
247
+        b.id AS ddcbid,
248
+        '' AS scnfValue,
249
+        '' as scnf,
250
+        '' AS cdValue,
251
+        '' as  cd,
252
+        lsxz_enum.enumName AS xzValue,
253
+        IFNULL(b.grain_nature_id,'6871')as xz,
254
+        b.unit_price as dj,
255
+        lspz_enum.enumName AS sjjlpzmc,
256
+        mxpz_enum.sjjlpzbh as sjjlpzbh,
257
+        b.quantity*1000 as sl,
258
+        mxpz_enum.dj as sjjldjbh,
259
+        lsdj_enum.enumName AS sjjldjmc,
216 260
 
261
+        mxpz_enum.sjjlspmc AS sjjlspmc,
262
+        mxpz_enum.sjjlspmcbh as sjjlspmcbh,
263
+        mxpz_enum.sjjlppbh as sjjlppbh,
264
+        lspp_enum.enumName AS sjjlppmc,
265
+        b.quantity*1000-b.complete_quantity*1000 as  sysl,
266
+        b.quantity*1000-b.complete_quantity*1000 as kcsl,
267
+        (b.quantity*1000-b.complete_quantity*1000)/mxpz_enum.gg as syjs,
268
+        '' as  ch,
269
+        mxpz_enum.gg as gg,
270
+        mxpz_enum.bzq as bzg,
271
+        mxpz_enum.jldw as jldw,
272
+        b.updatedate  as "ModifyDate",
273
+        jldw_enum.enumName AS jldwmc,
274
+        '1' as taxrate,
275
+        '' as istax
276
+        FROM
277
+         business_pg_gops_plan_detail b
278
+        LEFT JOIN data_crkyw_cplsp_default mxpz_enum ON mxpz_enum.dataId =b.crkyw_cplsp_default_id
279
+        LEFT JOIN basic_enum jldw_enum ON jldw_enum.enumId =mxpz_enum.jldw
280
+        LEFT JOIN basic_enum lsxz_enum ON lsxz_enum.enumId = IFNULL(b.grain_nature_id,'6871')  -- 默认其他商品粮
281
+        LEFT JOIN basic_enum lspz_enum ON lspz_enum.enumId = mxpz_enum.sjjlpzbh
282
+        LEFT JOIN basic_enum lsdj_enum ON lsdj_enum.enumId = mxpz_enum.dj
283
+        LEFT JOIN basic_enum lspp_enum ON lspp_enum.enumId = mxpz_enum.sjjlppbh
284
+        WHERE
285
+         b.pg_gops_plan_id = #{mainDataId}
286
+        and    b.quantity-b.complete_quantity > 0
287
+        order by b.updatedate desc
288
+    </select>
289
+    <select id="getPgGopsPlanDetail" resultType="com.unis.crk.cplbusiness.entity.result.BusinessPgGopsPlanDetailVO">
290
+        SELECT DISTINCT
291
+        b.id AS ddcbid,
292
+        b.pg_gops_plan_id as planId,
293
+        b.quantity * 1000 AS sl,
294
+        b.complete_quantity * 1000 AS wcsl,
295
+        b.quantity * 1000 - b.complete_quantity * 1000 AS sysl
296
+    FROM
297
+        business_pg_gops_plan_detail b
298
+    where b.id = #{ddcbid}
299
+    </select>
300
+    <update id="updatePgGopsPlanDetail">
301
+        UPDATE business_pg_gops_plan_detail
302
+        SET updatedate = NOW(),
303
+            complete_quantity = #{wcsl}
304
+        WHERE
305
+	      id=#{ddcbid}
306
+    </update>
307
+    <update id="updatePgGopsPlan">
308
+        UPDATE business_pg_gops_plan
309
+        SET
310
+          updatedate = NOW(),
311
+          completion_amount = completion_amount+#{sjjlje},
312
+          remaining_amount = remaining_amount-#{sjjlje},
313
+          completion_quantity = completion_quantity+#{wcsl}
314
+        WHERE
315
+	    id = #{mainDataId}
316
+    </update>
217 317
 </mapper>