|
|
@@ -31,9 +31,11 @@ import com.chinaitop.depot.business.service.FeignAgileService;
|
|
31
|
31
|
import com.chinaitop.depot.business.service.FeignBasicService;
|
|
32
|
32
|
import com.chinaitop.depot.business.service.ReceiveNoticeService;
|
|
33
|
33
|
import com.chinaitop.depot.business.service.SystemOutsideDataService;
|
|
|
34
|
+import com.chinaitop.depot.feignService.DepotSystemFeignService;
|
|
34
|
35
|
import com.chinaitop.depot.system.service.SysCodeService;
|
|
35
|
36
|
import com.chinaitop.depot.utils.HTTPUtils;
|
|
36
|
37
|
import com.chinaitop.depot.utils.ParameterUtil;
|
|
|
38
|
+import com.chinaitop.depot.utils.createKC;
|
|
37
|
39
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
38
|
40
|
import com.github.pagehelper.PageHelper;
|
|
39
|
41
|
|
|
|
@@ -47,6 +49,8 @@ public class ReceiveNoticeServiceImpl implements ReceiveNoticeService {
|
|
47
|
49
|
@Resource
|
|
48
|
50
|
private FeignAgileService feignAgileService;
|
|
49
|
51
|
@Resource
|
|
|
52
|
+ private DepotSystemFeignService depotSystemFeignService;
|
|
|
53
|
+ @Resource
|
|
50
|
54
|
private BusinessApprovalService businessApprovalService;
|
|
51
|
55
|
@Resource
|
|
52
|
56
|
private BusinessContractReceiveService businessContractReceiveService;
|
|
|
@@ -56,9 +60,6 @@ public class ReceiveNoticeServiceImpl implements ReceiveNoticeService {
|
|
56
|
60
|
private SystemOutsideDataService systemOutsideDataService;
|
|
57
|
61
|
|
|
58
|
62
|
public static final Logger logger = LoggerFactory.getLogger(ReceiveNoticeServiceImpl.class);
|
|
59
|
|
- /*@Resource
|
|
60
|
|
- private BusinessApprovalMapper approvalMapper;*/
|
|
61
|
|
-
|
|
62
|
63
|
|
|
63
|
64
|
// 获取ip地址
|
|
64
|
65
|
@Value("${crk-webservice}")
|
|
|
@@ -141,6 +142,7 @@ public class ReceiveNoticeServiceImpl implements ReceiveNoticeService {
|
|
141
|
142
|
if(businessNoticeReceive.getIsSheet()!=null){
|
|
142
|
143
|
createCriteria.andIsSheetEqualTo(businessNoticeReceive.getIsSheet());
|
|
143
|
144
|
}
|
|
|
145
|
+
|
|
144
|
146
|
if(pageNum!=null && pageSize!=null){
|
|
145
|
147
|
PageHelper.startPage(pageNum, pageSize);
|
|
146
|
148
|
}
|
|
|
@@ -323,7 +325,13 @@ public class ReceiveNoticeServiceImpl implements ReceiveNoticeService {
|
|
323
|
325
|
businessNoticeReceive.setGrainAnnual(Integer.parseInt(scnf));//收获年度
|
|
324
|
326
|
}
|
|
325
|
327
|
}
|
|
326
|
|
- } else {
|
|
|
328
|
+ //入库兜底类型的不需要审批性质转变单
|
|
|
329
|
+ if (ObjectUtils.toString(jsonObject.getString("ywlx")).equals("3")) {
|
|
|
330
|
+ businessNoticeReceive.setIsSheet(1);
|
|
|
331
|
+ } else {
|
|
|
332
|
+ businessNoticeReceive.setIsSheet(0);
|
|
|
333
|
+ }
|
|
|
334
|
+ } else {//出库类型
|
|
327
|
335
|
//根据仓房、货位、orgId获取粮食品种等信息
|
|
328
|
336
|
Map<String, Object> map = feignAgileService.getDateByChHwh(orgId, houseId, wareHouseId);
|
|
329
|
337
|
logger.info("根据orgId="+orgId+",houseId="+houseId+",warehouseId="+wareHouseId+" 获取到的库存数据如下:");
|
|
|
@@ -364,7 +372,7 @@ public class ReceiveNoticeServiceImpl implements ReceiveNoticeService {
|
|
364
|
372
|
businessNoticeReceive.setLsxzzbdh(jsonObject.getString("tzdid"));//粮食性质转变单单号
|
|
365
|
373
|
//SimpleDateFormat dateFormat= new SimpleDateFormat("yyyy-MM-dd :hh:mm:ss");
|
|
366
|
374
|
businessNoticeReceive.setHzrq(new Date());//划转时间
|
|
367
|
|
-
|
|
|
375
|
+ businessNoticeReceive.setIsSheet(0);//是性质转变单
|
|
368
|
376
|
}
|
|
369
|
377
|
String lsyqsl = jsonObject.getString("lsyqsl");
|
|
370
|
378
|
businessNoticeReceive.setCount(lsyqsl); //计划数量(吨)
|
|
|
@@ -374,7 +382,7 @@ public class ReceiveNoticeServiceImpl implements ReceiveNoticeService {
|
|
374
|
382
|
businessNoticeReceive.setIsNotice(0);//0是可以引用的通知单
|
|
375
|
383
|
businessNoticeReceive.setAuditState(0);//下达未审批
|
|
376
|
384
|
businessNoticeReceive.setReceiveTime(new Date());//接收数据的时间
|
|
377
|
|
- businessNoticeReceive.setIsSheet(0);//是性质转变单
|
|
|
385
|
+ //businessNoticeReceive.setSfzswtzd("0"); //接收通知单菜单不展示该数据
|
|
378
|
386
|
businessNoticeReceiveMapper.insert(businessNoticeReceive);
|
|
379
|
387
|
|
|
380
|
388
|
}
|
|
|
@@ -441,7 +449,7 @@ public class ReceiveNoticeServiceImpl implements ReceiveNoticeService {
|
|
441
|
449
|
createCriteria.andWareHouseIdEqualTo(businessNoticeReceive.getWareHouseId());
|
|
442
|
450
|
}
|
|
443
|
451
|
|
|
444
|
|
- //货位
|
|
|
452
|
+ //货位
|
|
445
|
453
|
if(businessNoticeReceive.getOrgId()!=null){
|
|
446
|
454
|
createCriteria.andOrgIdEqualTo(businessNoticeReceive.getOrgId());
|
|
447
|
455
|
}
|
|
|
@@ -521,11 +529,40 @@ public class ReceiveNoticeServiceImpl implements ReceiveNoticeService {
|
|
521
|
529
|
}
|
|
522
|
530
|
//增加审批表数据
|
|
523
|
531
|
businessApprovalService.add(businessApproval);
|
|
524
|
|
-
|
|
525
|
|
-
|
|
526
|
|
- }
|
|
527
|
532
|
|
|
|
533
|
+ //必须是入库,并且不是通知单,只是性质转变单
|
|
|
534
|
+ if ("1".equals(receiveNotice.getIsNotice()) && "1".equals(receiveNotice.getIsSheet()) && "1".equals(receiveNotice.getCrktype())) {
|
|
|
535
|
+ restLsxz(receiveNotice.getId());
|
|
|
536
|
+ }
|
|
|
537
|
+ }
|
|
528
|
538
|
|
|
|
539
|
+ public void restLsxz(Integer id) {
|
|
|
540
|
+ /* 先调用出入库接口生成转储的业务的台账信息,生成失败不可保存转储数据***start */
|
|
|
541
|
+ BusinessNoticeReceive receiveNotice = businessNoticeReceiveMapper.selectByPrimaryKey(id);
|
|
|
542
|
+ Object[] parameters = new Object[9];
|
|
|
543
|
+ parameters[0] = receiveNotice.getOrgId() + "";
|
|
|
544
|
+ parameters[1] = receiveNotice.getGrainKind() + "";
|
|
|
545
|
+ //parameters[2] = null;
|
|
|
546
|
+ parameters[3] = receiveNotice.getHouseId() + "";
|
|
|
547
|
+ if (StringUtils.isNotBlank(receiveNotice.getWareHouseId()+"")) {//粮仓
|
|
|
548
|
+ parameters[4] = receiveNotice.getWareHouseId() + "";
|
|
|
549
|
+ } else {
|
|
|
550
|
+ parameters[4] = receiveNotice.getHouseId() + "";//油罐
|
|
|
551
|
+ }
|
|
|
552
|
+ parameters[5] = receiveNotice.getHzqlsxzdm() + "";
|
|
|
553
|
+ parameters[6] = receiveNotice.getGrainAttribute() + "";
|
|
|
554
|
+ parameters[7] = Integer.parseInt(receiveNotice.getLssl())*1000 + "";
|
|
|
555
|
+ parameters[8] = 1 + ""; //1:新增;2:修改;3:删除
|
|
|
556
|
+
|
|
|
557
|
+ String crkurl = depotSystemFeignService.getUrl(receiveNotice.getOrgId().toString(), "2");
|
|
|
558
|
+ if (StringUtils.isNotBlank(crkurl)) {
|
|
|
559
|
+ String url_id = crkurl.substring(0, crkurl.lastIndexOf("Base")-1);
|
|
|
560
|
+ StringBuffer sbf = new StringBuffer();
|
|
|
561
|
+ sbf.append(url_id).append(url);
|
|
|
562
|
+ String str = createKC.createKC("ChangeGrainAttribute", sbf.toString(), parameters);
|
|
|
563
|
+ systemOutsideDataService.addlogger("rkxzzb", JSON.toJSONString(parameters), str);
|
|
|
564
|
+ }
|
|
|
565
|
+ }
|
|
529
|
566
|
|
|
530
|
567
|
@Override
|
|
531
|
568
|
public int queryIsOrAudit(String xybh, String sptDataId,Integer flag) {
|
|
|
@@ -555,54 +592,6 @@ public class ReceiveNoticeServiceImpl implements ReceiveNoticeService {
|
|
555
|
592
|
|
|
556
|
593
|
}
|
|
557
|
594
|
|
|
558
|
|
-
|
|
559
|
|
-
|
|
560
|
|
- @Override
|
|
561
|
|
- public void saveDataRk(String orgId, Integer storehouseId, Integer warehouseId, String grainVarietyName, BigDecimal rksl,
|
|
562
|
|
- String lsxzzbdh,String xyh) {
|
|
563
|
|
- // TODO Auto-generated method stub
|
|
564
|
|
-
|
|
565
|
|
- BusinessNoticeReceive businessNoticeReceive = new BusinessNoticeReceive();
|
|
566
|
|
- //String orgId = (String) paramMap.get("orgId");
|
|
567
|
|
- //Integer storehouseId = (Integer) paramMap.get("storehouseId");
|
|
568
|
|
- // warehouseId = (Integer) paramMap.get("warehouseId");
|
|
569
|
|
- //String pzmc = (String) paramMap.get("pzmc");
|
|
570
|
|
- // String hzsl = (String) paramMap.get("hzsl");
|
|
571
|
|
- //String lsxzzbdh = (String) paramMap.get("lsxzzbdh");
|
|
572
|
|
- System.out.println("orgId:----------------------------"+orgId+"storehouseId:-"+storehouseId+"warehouseId"+"////"+warehouseId);
|
|
573
|
|
- Map<String, Object> map = feignAgileService.getDateByChHwh(Integer.valueOf(orgId), storehouseId, warehouseId);
|
|
574
|
|
- System.out.println("map:----------------------------"+map);
|
|
575
|
|
- Integer grainKind = (Integer) map.get("pz"); //品种
|
|
576
|
|
- Double kcsl = (Double) map.get("kcsl");//千克
|
|
577
|
|
- Integer grainAttribute = (Integer) map.get("hwxz"); //粮油性质
|
|
578
|
|
- businessNoticeReceive.setAuditState(0);//下发未审批
|
|
579
|
|
- businessNoticeReceive.setIsNotice(1);//0是1否 是否是可以引用的通知单
|
|
580
|
|
- businessNoticeReceive.setOrgId(Integer.valueOf(orgId));
|
|
581
|
|
- businessNoticeReceive.setHouseId(storehouseId);
|
|
582
|
|
- businessNoticeReceive.setWareHouseId(warehouseId);
|
|
583
|
|
- businessNoticeReceive.setCount(rksl+"");
|
|
584
|
|
- businessNoticeReceive.setPzmc(grainVarietyName);
|
|
585
|
|
- businessNoticeReceive.setGrainKind(grainKind);
|
|
586
|
|
- businessNoticeReceive.setGrainAttribute(3052); //入库 转前 3052商品粮
|
|
587
|
|
- businessNoticeReceive.setHzqlsxzdm(grainAttribute);//入库 转后
|
|
588
|
|
- businessNoticeReceive.setContractNumber(xyh);
|
|
589
|
|
- businessNoticeReceive.setLsxzzbdh(lsxzzbdh);
|
|
590
|
|
- businessNoticeReceive.setNoticeNumber(lsxzzbdh);
|
|
591
|
|
- businessNoticeReceive.setCrktype("1"); //1入 3出
|
|
592
|
|
- BigDecimal s = new BigDecimal(1000);
|
|
593
|
|
- System.out.println(kcsl+"kcsl");
|
|
594
|
|
- BigDecimal kcslBig = new BigDecimal(String.valueOf(kcsl));
|
|
595
|
|
- System.out.println(kcslBig+"kcslBig");
|
|
596
|
|
-
|
|
597
|
|
- BigDecimal kcslKg = kcslBig.divide(s);
|
|
598
|
|
- businessNoticeReceive.setLssl(kcslKg.toString());//库存数量
|
|
599
|
|
- businessNoticeReceive.setHzrq(new Date());
|
|
600
|
|
- businessNoticeReceive.setReceiveTime(new Date());
|
|
601
|
|
- businessNoticeReceive.setIsSheet(0);
|
|
602
|
|
- businessNoticeReceiveMapper.insertSelective(businessNoticeReceive);
|
|
603
|
|
-
|
|
604
|
|
- }
|
|
605
|
|
-
|
|
606
|
595
|
@Override
|
|
607
|
596
|
public Map<String, Object> updateReceiveNotice(String notice) throws Exception {
|
|
608
|
597
|
Map<String, Object> map = new HashMap<>();
|
|
|
@@ -648,4 +637,101 @@ public class ReceiveNoticeServiceImpl implements ReceiveNoticeService {
|
|
648
|
637
|
return businessNoticeReceive;
|
|
649
|
638
|
}
|
|
650
|
639
|
|
|
|
640
|
+
|
|
|
641
|
+
|
|
|
642
|
+ @Override
|
|
|
643
|
+ public Map<String, Object> scRkxzzbd(String datas) {
|
|
|
644
|
+ Map<String, Object> result_map = new HashMap<>();
|
|
|
645
|
+
|
|
|
646
|
+ if (datas != null) {
|
|
|
647
|
+ // JSON字符串转对象
|
|
|
648
|
+ JSONObject jsonObject = JSONObject.parseObject(datas);
|
|
|
649
|
+
|
|
|
650
|
+ BusinessNoticeReceive businessNoticeReceive = new BusinessNoticeReceive();
|
|
|
651
|
+
|
|
|
652
|
+ businessNoticeReceive.setCrktype("1"); //默认值:入库
|
|
|
653
|
+ businessNoticeReceive.setYwtype("1");//默认值:竞价入库
|
|
|
654
|
+
|
|
|
655
|
+ String hwbm = jsonObject.getString("hwbm");//货位国标编码
|
|
|
656
|
+ if (hwbm != null) {
|
|
|
657
|
+ //查询仓房ID、货位ID、orgId
|
|
|
658
|
+ Map<String, Object> basicMap = feignBasicService.getWareOrTankObj(hwbm);
|
|
|
659
|
+ logger.info("根据值"+hwbm+"获取到的货位数据如下:");
|
|
|
660
|
+ logger.info(basicMap+"");
|
|
|
661
|
+ if ("0".equals(basicMap.get("houseId").toString())
|
|
|
662
|
+ || "0".equals(basicMap.get("warehouseId").toString())
|
|
|
663
|
+ || "0".equals(basicMap.get("orgId").toString())) {
|
|
|
664
|
+
|
|
|
665
|
+ result_map.put("msg", "根据值"+hwbm+"未获取到对应仓房货位信息,请核对数据");
|
|
|
666
|
+ result_map.put("status", "error");
|
|
|
667
|
+ return result_map;
|
|
|
668
|
+ } else {
|
|
|
669
|
+ Integer houseId = (Integer) basicMap.get("houseId");
|
|
|
670
|
+ Integer wareHouseId = (Integer) basicMap.get("warehouseId");
|
|
|
671
|
+ Integer orgId = (Integer) basicMap.get("orgId");
|
|
|
672
|
+ businessNoticeReceive.setHouseId(houseId); //仓房
|
|
|
673
|
+ if (!wareHouseId.toString().equals(houseId.toString())) {//只有粮仓才保存货位,油罐不保存货位
|
|
|
674
|
+ businessNoticeReceive.setWareHouseId(wareHouseId); //货位
|
|
|
675
|
+ }
|
|
|
676
|
+ businessNoticeReceive.setOrgId(orgId); //组织id
|
|
|
677
|
+ }
|
|
|
678
|
+ } else {
|
|
|
679
|
+ result_map.put("msg", "hwbm不能为空");
|
|
|
680
|
+ result_map.put("status", "error");
|
|
|
681
|
+ return result_map;
|
|
|
682
|
+ }
|
|
|
683
|
+
|
|
|
684
|
+ Map<String, Object> kcmap = feignAgileService.getDateByChHwh(businessNoticeReceive.getOrgId(), businessNoticeReceive.getHouseId(), businessNoticeReceive.getWareHouseId());
|
|
|
685
|
+ logger.info("根据orgId="+businessNoticeReceive.getOrgId()+",houseId="+businessNoticeReceive.getHouseId()+",warehouseId="+businessNoticeReceive.getWareHouseId()+" 获取到的库存数据如下:");
|
|
|
686
|
+ logger.info(kcmap+"");
|
|
|
687
|
+ if (null != kcmap) {
|
|
|
688
|
+ String inputTime = kcmap.get("rq")+""; //入库时间
|
|
|
689
|
+ Double kcsl = (Double) kcmap.get("kcsl");//千克
|
|
|
690
|
+ Date date = null;
|
|
|
691
|
+ if(inputTime!=null){
|
|
|
692
|
+ date = ParameterUtil.string2datetime(inputTime);
|
|
|
693
|
+ businessNoticeReceive.setInputTime(date);//入库时间
|
|
|
694
|
+ }
|
|
|
695
|
+ businessNoticeReceive.setProductiveYear(Integer.parseInt(kcmap.get("scnf")+""));//生产年份
|
|
|
696
|
+ businessNoticeReceive.setGrainAnnual(Integer.parseInt(kcmap.get("scnf")+""));//收获年度
|
|
|
697
|
+ businessNoticeReceive.setGrainKind((Integer) kcmap.get("pz")); //品种
|
|
|
698
|
+ businessNoticeReceive.setGrainDetailKind((Integer) kcmap.get("mxpz")); //明细品种
|
|
|
699
|
+ businessNoticeReceive.setGrainGrade((Integer) kcmap.get("dj")); //等级
|
|
|
700
|
+ businessNoticeReceive.setGrainAttribute((Integer) kcmap.get("hwxz")); //粮油性质
|
|
|
701
|
+ businessNoticeReceive.setGrainProducingArea((Integer) kcmap.get("gb"));//产地
|
|
|
702
|
+
|
|
|
703
|
+ /**
|
|
|
704
|
+ * 库存数量转化为吨
|
|
|
705
|
+ */
|
|
|
706
|
+ BigDecimal s = new BigDecimal(1000);
|
|
|
707
|
+ BigDecimal kcslBig = new BigDecimal(kcsl);
|
|
|
708
|
+ BigDecimal kcslKg = kcslBig.divide(s);
|
|
|
709
|
+ businessNoticeReceive.setLssl(kcslKg.toString());//库存数量
|
|
|
710
|
+
|
|
|
711
|
+ businessNoticeReceive.setHzqlsxzdm(3052);//商品粮 转后,划转后粮食性质
|
|
|
712
|
+ StringBuffer sbf = new StringBuffer(50);
|
|
|
713
|
+ Date thisdate = new Date();
|
|
|
714
|
+ sbf.append("RKXZZBD").append(String.format("%03d", businessNoticeReceive.getOrgId())).append(ParameterUtil.getDateYMDHMS(thisdate));
|
|
|
715
|
+ businessNoticeReceive.setLsxzzbdh(sbf.toString());//粮食性质转变单单号
|
|
|
716
|
+ businessNoticeReceive.setHzrq(thisdate);//划转时间
|
|
|
717
|
+ businessNoticeReceive.setCount(businessNoticeReceive.getLssl()); //计划数量(吨)
|
|
|
718
|
+ businessNoticeReceive.setInApplication(1); //启用
|
|
|
719
|
+ businessNoticeReceive.setAuditState(0);//下达未审批
|
|
|
720
|
+ businessNoticeReceive.setReceiveTime(thisdate);//接收数据的时间
|
|
|
721
|
+ businessNoticeReceive.setIsNotice(1);//0是可以引用的通知单,1不是
|
|
|
722
|
+ businessNoticeReceive.setIsSheet(0);//0代表是性质转变单
|
|
|
723
|
+ businessNoticeReceiveMapper.insert(businessNoticeReceive);
|
|
|
724
|
+ } else {
|
|
|
725
|
+ result_map.put("msg", "根据所传信息没有查到对应库存信息");
|
|
|
726
|
+ result_map.put("status", "error");
|
|
|
727
|
+ return result_map;
|
|
|
728
|
+ }
|
|
|
729
|
+ } else {
|
|
|
730
|
+ result_map.put("msg", "所传数据不能为空");
|
|
|
731
|
+ result_map.put("status", "error");
|
|
|
732
|
+ }
|
|
|
733
|
+
|
|
|
734
|
+ return result_map;
|
|
|
735
|
+ }
|
|
|
736
|
+
|
|
651
|
737
|
}
|