|
|
@@ -1,14 +1,22 @@
|
|
|
package com.steerinfo.meterwork.meterworkcaractualfirst.service.impl;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.steerinfo.baseinfo.combaseinfo.mapper.ComBaseInfoMapper;
|
|
|
+import com.steerinfo.baseinfo.combaseinfo.model.ComBaseInfo;
|
|
|
import com.steerinfo.baseinfo.meterbaseaddweight.mapper.MeterBaseAddWeightMapper;
|
|
|
import com.steerinfo.baseinfo.meterbaseaddweight.model.MeterBaseAddWeight;
|
|
|
+import com.steerinfo.baseinfo.meterbasecar.mapper.MeterBaseCarMapper;
|
|
|
+import com.steerinfo.baseinfo.meterbasecar.model.MeterBaseCar;
|
|
|
import com.steerinfo.baseinfo.meterbasehistaredata.mapper.MeterBaseHisTareDataMapper;
|
|
|
import com.steerinfo.baseinfo.meterbasehistaredata.model.MeterBaseHisTareData;
|
|
|
import com.steerinfo.baseinfo.meterbasehistaredetail.mapper.MeterBaseHisTareDetailMapper;
|
|
|
import com.steerinfo.baseinfo.meterbasehistaredetail.model.MeterBaseHisTareDetail;
|
|
|
import com.steerinfo.baseinfo.meterbasematterinfo.mapper.MeterBaseMatterInfoMapper;
|
|
|
import com.steerinfo.baseinfo.meterbasematterinfo.model.MeterBaseMatterInfo;
|
|
|
+import com.steerinfo.baseinfo.meterbasemattermap.mapper.MeterBaseMatterMapMapper;
|
|
|
+import com.steerinfo.baseinfo.meterbasemattermap.model.MeterBaseMatterMap;
|
|
|
+import com.steerinfo.baseinfo.meterbaseoperationlog.mapper.MeterBaseOperationLogMapper;
|
|
|
+import com.steerinfo.baseinfo.meterbaseoperationlog.model.MeterBaseOperationLog;
|
|
|
import com.steerinfo.baseinfo.meterbasespotinfo.mapper.MeterBaseSpotInfoMapper;
|
|
|
import com.steerinfo.baseinfo.meterbasespotinfo.model.MeterBaseSpotInfo;
|
|
|
import com.steerinfo.baseinfo.meterbasetermtaredata.mapper.MeterBaseTermTareDataMapper;
|
|
|
@@ -97,6 +105,18 @@ public class MeterWorkCarActualFirstServiceImpl extends BaseServiceImpl<MeterWor
|
|
|
@Resource
|
|
|
private MeterWorkCraneActualMapper craneActualMapper;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private MeterBaseCarMapper meterBaseCarMapper;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private MeterBaseOperationLogMapper meterBaseOperationLogMapper;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private ComBaseInfoMapper comBaseInfoMapper;
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private MeterBaseMatterMapMapper meterBaseMatterMapMapper;
|
|
|
+
|
|
|
@Resource
|
|
|
private MeterBaseSpotInfoMapper meterBaseSpotInfoMapper;
|
|
|
|
|
|
@@ -248,6 +268,29 @@ public class MeterWorkCarActualFirstServiceImpl extends BaseServiceImpl<MeterWor
|
|
|
public int checkcarandupdate(MeterWorkCarActualFirst model) throws MarkerMetException {
|
|
|
try {
|
|
|
ckeckcar(model);
|
|
|
+
|
|
|
+ UserPayload payload = UserPayload.getCurrUser();
|
|
|
+ String userId = payload.getId();
|
|
|
+ String userName = payload.getUserName();
|
|
|
+ model.setUpdateTime(new Date());
|
|
|
+ model.setUpdateManNo(userId);
|
|
|
+ model.setUpdateManName(userName);
|
|
|
+
|
|
|
+ MeterWorkCarActualFirst modelTemp = meterWorkCarActualFirstMapper.selectByPrimaryKey(model.getActualFirstNo());
|
|
|
+
|
|
|
+ MeterBaseOperationLog logModel = new MeterBaseOperationLog();
|
|
|
+ logModel.setId(PublicMethod.IdCreate(2));
|
|
|
+ logModel.setCreateManNo(userId);
|
|
|
+ logModel.setCreateManName(userName);
|
|
|
+ logModel.setCreateTime(new Date());
|
|
|
+ logModel.setOperationPage("web端-汽车衡一次数据维护");
|
|
|
+ logModel.setOperationFunction("车号修改");
|
|
|
+ logModel.setOperationId(model.getActualFirstNo());
|
|
|
+ logModel.setOperationPredictionNo(model.getPredictionNo());
|
|
|
+ logModel.setOperationCarnNo(model.getCarNo());
|
|
|
+ logModel.setOperationBeforeFix(modelTemp.getCarNo());
|
|
|
+ logModel.setOperationAfterFix(model.getCarNo());
|
|
|
+ meterBaseOperationLogMapper.insertSelective(logModel);
|
|
|
int num = meterWorkCarActualFirstMapper.updateByPrimaryKeySelective(model);
|
|
|
return num;
|
|
|
} catch (MarkerMetException e) {
|
|
|
@@ -311,6 +354,16 @@ public class MeterWorkCarActualFirstServiceImpl extends BaseServiceImpl<MeterWor
|
|
|
if (models.size() <= 0 || models == null) {
|
|
|
throw new MarkerMetException(500, "参数为空!!");
|
|
|
}
|
|
|
+ String userId = "";
|
|
|
+ String userName = "";
|
|
|
+ try{
|
|
|
+ UserPayload userPayload = UserPayload.getCurrUser();
|
|
|
+ userId = userPayload.getUserCode();
|
|
|
+ userName = userPayload.getUserName();
|
|
|
+ }catch (Exception e) {
|
|
|
+ userId = "system";
|
|
|
+ userName = "system";
|
|
|
+ }
|
|
|
for (MeterWorkCarActualFirst model : models) {
|
|
|
if (model.getValueFlag().equals(DbConstants.NET)) {
|
|
|
throw new MarkerMetException(500, "已结净的数据不可再废除!!");
|
|
|
@@ -319,6 +372,18 @@ public class MeterWorkCarActualFirstServiceImpl extends BaseServiceImpl<MeterWor
|
|
|
model.setValueFlag(DbConstants.INVALID);
|
|
|
meterWorkCarActualFirstMapper.updateByPrimaryKeySelective(model);
|
|
|
num++;
|
|
|
+
|
|
|
+ MeterBaseOperationLog logModel = new MeterBaseOperationLog();
|
|
|
+ logModel.setId(PublicMethod.IdCreate(2));
|
|
|
+ logModel.setCreateManNo(userId);
|
|
|
+ logModel.setCreateManName(userName);
|
|
|
+ logModel.setCreateTime(new Date());
|
|
|
+ logModel.setOperationPage("web端-汽车衡一次数据维护");
|
|
|
+ logModel.setOperationFunction("作废");
|
|
|
+ logModel.setOperationId(model.getActualFirstNo());
|
|
|
+ logModel.setOperationPredictionNo(model.getPredictionNo());
|
|
|
+ logModel.setOperationCarnNo(model.getCarNo());
|
|
|
+ meterBaseOperationLogMapper.insertSelective(logModel);
|
|
|
}
|
|
|
for (MeterWorkCarActualFirst model : models) {
|
|
|
if (StringUtils.isNotEmpty(model.getPredictionNo())
|
|
|
@@ -429,6 +494,16 @@ public class MeterWorkCarActualFirstServiceImpl extends BaseServiceImpl<MeterWor
|
|
|
if (models.size() <= 0 || models == null) {
|
|
|
throw new MarkerMetException(500, "请选择需要启用的数据!!");
|
|
|
}
|
|
|
+ String userId = "";
|
|
|
+ String userName = "";
|
|
|
+ try{
|
|
|
+ UserPayload userPayload = UserPayload.getCurrUser();
|
|
|
+ userId = userPayload.getUserCode();
|
|
|
+ userName = userPayload.getUserName();
|
|
|
+ }catch (Exception e) {
|
|
|
+ userId = "system";
|
|
|
+ userName = "system";
|
|
|
+ }
|
|
|
for (MeterWorkCarActualFirst model : models) {
|
|
|
if (model.getValueFlag().equals(DbConstants.NET)) {
|
|
|
throw new MarkerMetException(500, "计量数据已经结净,无法启用");
|
|
|
@@ -436,6 +511,18 @@ public class MeterWorkCarActualFirstServiceImpl extends BaseServiceImpl<MeterWor
|
|
|
model.setValueFlag(DbConstants.VALID);
|
|
|
meterWorkCarActualFirstMapper.updateByPrimaryKeySelective(model);
|
|
|
|
|
|
+ MeterBaseOperationLog logModel = new MeterBaseOperationLog();
|
|
|
+ logModel.setId(PublicMethod.IdCreate(2));
|
|
|
+ logModel.setCreateManNo(userId);
|
|
|
+ logModel.setCreateManName(userName);
|
|
|
+ logModel.setCreateTime(new Date());
|
|
|
+ logModel.setOperationPage("web端-汽车衡一次数据维护");
|
|
|
+ logModel.setOperationFunction("启用");
|
|
|
+ logModel.setOperationId(model.getActualFirstNo());
|
|
|
+ logModel.setOperationPredictionNo(model.getPredictionNo());
|
|
|
+ logModel.setOperationCarnNo(model.getCarNo());
|
|
|
+ meterBaseOperationLogMapper.insertSelective(logModel);
|
|
|
+
|
|
|
if (StringUtils.isNotEmpty(model.getPredictionNo())
|
|
|
&& model.getPredictionNo().length() > 10) {
|
|
|
PreTrackScale ps = new PreTrackScale();
|
|
|
@@ -515,6 +602,17 @@ public class MeterWorkCarActualFirstServiceImpl extends BaseServiceImpl<MeterWor
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public int remove(List<MeterWorkCarActualFirst> models) throws MarkerMetException {
|
|
|
try {
|
|
|
+ String userId = "";
|
|
|
+ String userName = "";
|
|
|
+ try{
|
|
|
+ UserPayload userPayload = UserPayload.getCurrUser();
|
|
|
+ userId = userPayload.getUserCode();
|
|
|
+ userName = userPayload.getUserName();
|
|
|
+ }catch (Exception e) {
|
|
|
+ userId = "system";
|
|
|
+ userName = "system";
|
|
|
+ }
|
|
|
+
|
|
|
int num = 0;
|
|
|
if (models.size() <= 0 || models == null) {
|
|
|
throw new MarkerMetException(500, "参数为空!!");
|
|
|
@@ -554,8 +652,8 @@ public class MeterWorkCarActualFirstServiceImpl extends BaseServiceImpl<MeterWor
|
|
|
throw new MarkerMetException(500, "数据对应的委托不存在!!");
|
|
|
}
|
|
|
pls.setUpdateTime(new Date());
|
|
|
- pls.setUpdateManNo("system");
|
|
|
- pls.setUpdateManName("一次计量数据解除操作");
|
|
|
+ pls.setUpdateManNo(userId);
|
|
|
+ pls.setUpdateManName(userName);
|
|
|
pls.setValueFlag(DbConstants.VALID);
|
|
|
pls.setUploadFlag("1");
|
|
|
preTrackScaleMapper.updateByPrimaryKeySelective(pls);
|
|
|
@@ -567,6 +665,19 @@ public class MeterWorkCarActualFirstServiceImpl extends BaseServiceImpl<MeterWor
|
|
|
meterWorkPreLinkMapper.updateByPrimaryKey(mwpl);
|
|
|
}
|
|
|
|
|
|
+ //操作日志
|
|
|
+ MeterBaseOperationLog logModel = new MeterBaseOperationLog();
|
|
|
+ logModel.setId(PublicMethod.IdCreate(2));
|
|
|
+ logModel.setCreateManNo(userId);
|
|
|
+ logModel.setCreateManName(userName);
|
|
|
+ logModel.setCreateTime(new Date());
|
|
|
+ logModel.setOperationPage("web端-汽车衡一次数据维护");
|
|
|
+ logModel.setOperationFunction("汽车衡撤销委托");
|
|
|
+ logModel.setOperationId(model.getActualFirstNo());
|
|
|
+ logModel.setOperationPredictionNo(model.getPredictionNo());
|
|
|
+ logModel.setOperationCarnNo(model.getCarNo());
|
|
|
+ logModel.setOperationBeforeFix(model.toString());
|
|
|
+
|
|
|
MeterWorkCarActualFirst mwcaf = meterWorkCarActualFirstMapper.selectAndRemove(model.getActualFirstNo());
|
|
|
|
|
|
String actualFirstNo = mwcaf.getActualFirstNo();
|
|
|
@@ -593,8 +704,15 @@ public class MeterWorkCarActualFirstServiceImpl extends BaseServiceImpl<MeterWor
|
|
|
|
|
|
// 将一次计量数据设置为未匹配状态
|
|
|
//mwcaf.setValueFlag("2");
|
|
|
+ mwcaf.setUpdateManNo(userId);
|
|
|
+ mwcaf.setUpdateManName(userName);
|
|
|
+ mwcaf.setUpdateTime(new Date());
|
|
|
+ mwcaf.setNote("一次数据撤销委托");
|
|
|
mwcaf.setIsPreScale("0");
|
|
|
meterWorkCarActualFirstMapper.updateByPrimaryKey(mwcaf);
|
|
|
+
|
|
|
+ logModel.setOperationAfterFix(mwcaf.toString());
|
|
|
+ meterBaseOperationLogMapper.insertSelective(logModel);
|
|
|
num++;
|
|
|
}
|
|
|
return num;
|
|
|
@@ -627,10 +745,29 @@ public class MeterWorkCarActualFirstServiceImpl extends BaseServiceImpl<MeterWor
|
|
|
Assert.isTrue(pts != null, "委托编号:" + predictionNo + "未查询到有效委托信息");
|
|
|
MeterWorkCarActualFirst model = meterWorkCarActualFirstMapper.selectByPrimaryKey(actualFirstNo);
|
|
|
Assert.isTrue(model != null, "一次数据不存在");
|
|
|
- Assert.isTrue(model.getPredictionNo() == null && StringUtils.isEmpty(model.getPredictionNo()), "一次数据已匹配,不允许计量");
|
|
|
+ Assert.isTrue(!model.getValueFlag().equals("2"), "一次数据已结净,不允许匹配委托,请在洁净数据维护中进行洁净匹配委托");
|
|
|
+ Assert.isTrue(model.getPredictionNo() == null && StringUtils.isEmpty(model.getPredictionNo()), "一次数据已匹配,不允许匹配委托");
|
|
|
+
|
|
|
+ //操作日志
|
|
|
+ MeterBaseOperationLog logModel = new MeterBaseOperationLog();
|
|
|
+ logModel.setId(PublicMethod.IdCreate(2));
|
|
|
+ logModel.setCreateManNo(userId);
|
|
|
+ logModel.setCreateManName(userName);
|
|
|
+ logModel.setCreateTime(new Date());
|
|
|
+ logModel.setOperationPage("web端-汽车衡一次数据维护");
|
|
|
+ logModel.setOperationFunction("汽车衡匹配委托");
|
|
|
+ logModel.setOperationId(model.getActualFirstNo());
|
|
|
+ logModel.setOperationPredictionNo(model.getPredictionNo());
|
|
|
+ logModel.setOperationCarnNo(model.getCarNo());
|
|
|
+ logModel.setOperationBeforeFix(model.toString());
|
|
|
+
|
|
|
+ //匹配委托操作
|
|
|
MeterWorkCarActualFirst modelTemp = meterWorkCarActualFirstMapper.selectAndMatch(actualFirstNo, pts.getPredictionNo());
|
|
|
BeanUtils.copyProperties(modelTemp, model);
|
|
|
model.setIsPreScale("1");
|
|
|
+ model.setUpdateManNo(userId);
|
|
|
+ model.setUpdateManName(userName);
|
|
|
+ model.setUpdateTime(new Date());
|
|
|
model.setNote("一次数据匹配委托");
|
|
|
model.setPredictionNo(pts.getPredictionNo());
|
|
|
meterWorkCarActualFirstMapper.updateByPrimaryKeySelective(model);
|
|
|
@@ -642,7 +779,10 @@ public class MeterWorkCarActualFirstServiceImpl extends BaseServiceImpl<MeterWor
|
|
|
pts.setUploadFlag("1");
|
|
|
pts.setMeasureStation(model.getBaseSpotNo());
|
|
|
pts.setMeasureStationName(model.getBaseSpotName());
|
|
|
- preTrackScaleMapper.updateByPrimaryKey(pts);
|
|
|
+ preTrackScaleMapper.updateByPrimaryKeySelective(pts);
|
|
|
+
|
|
|
+ logModel.setOperationAfterFix(model.toString());
|
|
|
+ meterBaseOperationLogMapper.insertSelective(logModel);
|
|
|
|
|
|
rm.setSucceed();
|
|
|
rm.setCode("200");
|
|
|
@@ -4135,7 +4275,49 @@ public class MeterWorkCarActualFirstServiceImpl extends BaseServiceImpl<MeterWor
|
|
|
rm.setMessage("请根据一次数据从大到小的规则,依次选择两条一次数据!!");
|
|
|
return rm;
|
|
|
}
|
|
|
- //判断双委托 物料相同、A委托的收货单位是B委托的发货单位 或者 B委托的收货单位是A委托的发货单位
|
|
|
+// HashMap<String, Object> carMap = new HashMap();
|
|
|
+// carMap.put("carNo", mwcaf01.getCarNo());
|
|
|
+// carMap.put("valueFlag", "1");
|
|
|
+// List<MeterBaseCar> carList = meterBaseCarMapper.selectByParameters(carMap);
|
|
|
+// //判断车辆是否是内倒车辆
|
|
|
+// if(carList.size() >= 1 && carList.get(0).getCarTypeNo().equals("001004003")) {
|
|
|
+// HashMap<String, Object> innerCarMap = new HashMap<>();
|
|
|
+// innerCarMap.put("pBaseCode", "001047");
|
|
|
+// innerCarMap.put("validFlag", "1");
|
|
|
+// innerCarMap.put("baseName", mwcaf01.getCarNo());
|
|
|
+// List<ComBaseInfo> innerCarList = comBaseInfoMapper.selectByParameters(innerCarMap);
|
|
|
+// //判断配置表里是否配置了车辆为内部双委托车辆
|
|
|
+// if(innerCarList.size() >= 1) {
|
|
|
+// //内部车辆需要查询一下物料映射
|
|
|
+// HashMap<String, Object> matterMap = new HashMap<>();
|
|
|
+// matterMap.put("maaterNo1", pts01.getMatterNo());
|
|
|
+// matterMap.put("maaterNo2", pts02.getMatterNo());
|
|
|
+// List<MeterBaseMatterMap> matterMapList = meterBaseMatterMapMapper.selectByParameters(matterMap);
|
|
|
+// if(matterMapList.size() >= 1) {
|
|
|
+// if(pts01.getReceivingUintNo().equals(pts02.getForwardingUnitNo()) ||
|
|
|
+// pts01.getForwardingUnitNo().equals(pts02.getReceivingUintNo())) {
|
|
|
+// rm.setMessage("内部车--委托信息不符合双委托规则,请确认!!");
|
|
|
+// return rm;
|
|
|
+// }
|
|
|
+// }else {
|
|
|
+// rm.setMessage("内部车--委托信息的物料不存在映射关系,请确认!!");
|
|
|
+// return rm;
|
|
|
+// }
|
|
|
+// }else{
|
|
|
+// rm.setMessage(mwcaf01.getCarNo() + "不是内倒双委托车辆,请确认!!");
|
|
|
+// return rm;
|
|
|
+// }
|
|
|
+// }else {
|
|
|
+// //外部车辆需要严格控制
|
|
|
+// //判断双委托 物料相同、A委托的收货单位是B委托的发货单位 或者 B委托的收货单位是A委托的发货单位
|
|
|
+// if(!(pts01.getMatterNo().equals(pts02.getMatterNo()) &&
|
|
|
+// (pts01.getReceivingUintNo().equals(pts02.getForwardingUnitNo()) ||
|
|
|
+// pts01.getForwardingUnitNo().equals(pts02.getReceivingUintNo())))) {
|
|
|
+// rm.setMessage("外部车--委托信息不符合双委托规则,请确认!!");
|
|
|
+// return rm;
|
|
|
+// }
|
|
|
+// }
|
|
|
+
|
|
|
if(!(pts01.getMatterNo().equals(pts02.getMatterNo()) &&
|
|
|
(pts01.getReceivingUintNo().equals(pts02.getForwardingUnitNo()) ||
|
|
|
pts01.getForwardingUnitNo().equals(pts02.getReceivingUintNo())))) {
|
|
|
@@ -4170,7 +4352,6 @@ public class MeterWorkCarActualFirstServiceImpl extends BaseServiceImpl<MeterWor
|
|
|
return rm;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
//将委托中的编号和收发货的等数据拷贝进一次数据中
|
|
|
MeterWorkCarActualFirst first1 = meterWorkCarActualFirstMapper.selectAndMatch(actualNo1, predictionNo1);
|
|
|
BeanUtils.copyProperties(first1,mwcaf01);
|
|
|
@@ -5418,6 +5599,20 @@ public class MeterWorkCarActualFirstServiceImpl extends BaseServiceImpl<MeterWor
|
|
|
scale.setMeasureStationName(actualRow.getNetSpot3Name());
|
|
|
preTrackScaleMapper.updateByPrimaryKeySelective(scale);
|
|
|
|
|
|
+ MeterBaseOperationLog logModel = new MeterBaseOperationLog();
|
|
|
+ logModel.setId(PublicMethod.IdCreate(2));
|
|
|
+ logModel.setCreateManNo(userId);
|
|
|
+ logModel.setCreateManName(userName);
|
|
|
+ logModel.setCreateTime(new Date());
|
|
|
+ logModel.setOperationPage("web端-一次数据维护");
|
|
|
+ logModel.setOperationFunction("期限皮洁净");
|
|
|
+ logModel.setOperationId(grossModel.getActualFirstNo());
|
|
|
+ logModel.setOperationPredictionNo(grossModel.getPredictionNo());
|
|
|
+ logModel.setOperationCarnNo(grossModel.getCarNo());
|
|
|
+ logModel.setOperationBeforeFix("一次数据:" + grossModel.toString());
|
|
|
+ logModel.setOperationAfterFix("洁净数据:" + actualRow.toString());
|
|
|
+ meterBaseOperationLogMapper.insertSelective(logModel);
|
|
|
+
|
|
|
rm.setSucceed();
|
|
|
rm.setData(actualRow);
|
|
|
rm.setMessage("有委托期限皮结净成功");
|
|
|
@@ -5482,6 +5677,20 @@ public class MeterWorkCarActualFirstServiceImpl extends BaseServiceImpl<MeterWor
|
|
|
}
|
|
|
meterWorkCarActualMapper.insertSelective(actualRow);
|
|
|
|
|
|
+ MeterBaseOperationLog logModel = new MeterBaseOperationLog();
|
|
|
+ logModel.setId(PublicMethod.IdCreate(2));
|
|
|
+ logModel.setCreateManNo(userId);
|
|
|
+ logModel.setCreateManName(userName);
|
|
|
+ logModel.setCreateTime(new Date());
|
|
|
+ logModel.setOperationPage("web端-一次数据维护");
|
|
|
+ logModel.setOperationFunction("期限皮洁净");
|
|
|
+ logModel.setOperationId(grossModel.getActualFirstNo());
|
|
|
+ logModel.setOperationPredictionNo(grossModel.getPredictionNo());
|
|
|
+ logModel.setOperationCarnNo(grossModel.getCarNo());
|
|
|
+ logModel.setOperationBeforeFix("一次数据:" + grossModel.toString());
|
|
|
+ logModel.setOperationAfterFix("洁净数据:" + actualRow.toString());
|
|
|
+ meterBaseOperationLogMapper.insertSelective(logModel);
|
|
|
+
|
|
|
rm.setSucceed();
|
|
|
rm.setData(actualRow);
|
|
|
rm.setMessage("无委托期限皮结净成功");
|