|
@@ -1,6 +1,7 @@
|
|
|
package com.steerinfo.dil.service.impl;
|
|
|
|
|
|
|
|
|
+import com.steerinfo.dil.feign.WmshboundFeign;
|
|
|
import com.steerinfo.dil.mapper.DilBatchInfacotryMapper;
|
|
|
import com.steerinfo.dil.mapper.DilBatchMapper;
|
|
|
import com.steerinfo.dil.model.DilBatch;
|
|
@@ -36,7 +37,8 @@ public class DilBatchServiceImpl implements IDilBatchService {
|
|
|
private DilBatchMapper dilBatchMapper;
|
|
|
@Autowired
|
|
|
private DilBatchInfacotryMapper dilBatchInfacotryMapper;
|
|
|
-
|
|
|
+ @Autowired
|
|
|
+ private WmshboundFeign wmshboundFeign;
|
|
|
|
|
|
|
|
|
@Override
|
|
@@ -79,7 +81,13 @@ public class DilBatchServiceImpl implements IDilBatchService {
|
|
|
//首先根据外轮船名和批次查找批次主表id是否存在
|
|
|
List<Map<String,Object>> BatchId = dilBatchMapper.selectBatchIdByForeign(map);
|
|
|
if (BatchId.size()!=0){
|
|
|
- dilBatchInfacotry.setBatchId(batchIds);
|
|
|
+ if(batchIds==null || batchIds.compareTo(new BigDecimal(0))==0){
|
|
|
+ //如果录入的批次已经存在,则采用之前的批次
|
|
|
+ batchId1=DataChange.dataToBigDecimal(BatchId.get(0).get("batchId"));
|
|
|
+ dilBatchInfacotry.setBatchId(batchId1);
|
|
|
+ }else{
|
|
|
+ dilBatchInfacotry.setBatchId(batchIds);
|
|
|
+ }
|
|
|
}else {
|
|
|
DilBatch dilBatch = new DilBatch();
|
|
|
batchId1 = dilBatchMapper.selectBatchId();
|
|
@@ -120,4 +128,32 @@ public class DilBatchServiceImpl implements IDilBatchService {
|
|
|
return dilBatchMapper.getNoticeContactNumberByPerson(personName);
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public List<Map<String, Object>> findBatchForBind(Map<String, Object> map) {
|
|
|
+ return dilBatchMapper.findBatchForBind(map);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public int bindBatch(Map<String, Object> map) throws Exception {
|
|
|
+ int i=0;
|
|
|
+ //校验
|
|
|
+ if(map.get("batchInfactoryId")==null || map.get("batchIdOld")==null || map.get("batchId") ==null
|
|
|
+ || map.get("userId") ==null || map.get("gmId")==null || map.get("portId")==null){
|
|
|
+ throw new Exception("数据异常,请检查是否输入正确数据!");
|
|
|
+ }
|
|
|
+ //取值
|
|
|
+ BigDecimal batchInfactoryId = DataChange.dataToBigDecimal(map.get("batchInfactoryId"));
|
|
|
+ BigDecimal batchId = DataChange.dataToBigDecimal(map.get("batchId"));
|
|
|
+ BigDecimal userId = DataChange.dataToBigDecimal(map.get("userId"));
|
|
|
+ //更新批次中间表的关联批次
|
|
|
+ DilBatchInfacotry dilBatchInfacotry=new DilBatchInfacotry();
|
|
|
+ dilBatchInfacotry.setBatchInfacotryId(batchInfactoryId);
|
|
|
+ dilBatchInfacotry.setBatchId(batchId);
|
|
|
+ dilBatchInfacotry.setUpdateUsername(userId.toString());
|
|
|
+ i+=dilBatchInfacotryMapper.updateByPrimaryKeySelective(dilBatchInfacotry);
|
|
|
+ //更新港存库、入库、出库的批次id
|
|
|
+ wmshboundFeign.updateWmshGridMaterial(map);
|
|
|
+ return i;
|
|
|
+ }
|
|
|
}
|