|
|
@@ -122,6 +122,7 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
|
|
|
Long companyId = BaseContextHolder.getCompanyId();
|
|
|
//人员Id
|
|
|
Long userId = BaseContextHolder.getUserId();
|
|
|
+ String userName = BaseContextHolder.getUserName();
|
|
|
|
|
|
//获取主表信息
|
|
|
ProdInOutDTO main = formdata.getMain();
|
|
|
@@ -130,28 +131,23 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
|
|
|
List<ProdIODetail> insertDetails = new ArrayList<>();
|
|
|
//更新从表数据
|
|
|
List<ProdIODetail> updateDetails = new ArrayList<>();
|
|
|
- DocBaseDTO baseDTO = new DocBaseDTO();
|
|
|
Long pi_id = main.getId();
|
|
|
String pi_inoutno = main.getPi_inoutno();
|
|
|
String pi_class = main.getPi_class();
|
|
|
ProdInOut prodInOut = BeanMapper.map(main,ProdInOut.class);
|
|
|
- prodInOut.setCompanyId(companyId);
|
|
|
- prodInOut.setPi_recordmanid(userId.intValue());
|
|
|
-// prodInOut.setPi_recordman(emp.get("em_name").toString());
|
|
|
- prodInOut.setCreatorId(userId);
|
|
|
- prodInOut.setCreateTime(new Date());
|
|
|
- prodInOut.setPi_date(new Date());
|
|
|
- prodInOut.setPi_puid(main.getPi_puid());
|
|
|
- prodInOut.setPi_pucode(main.getPi_pucode());
|
|
|
+
|
|
|
+ //编号获取
|
|
|
+ DocBaseDTO baseDTO = new DocBaseDTO();
|
|
|
baseDTO.setCode(pi_inoutno);
|
|
|
baseDTO.setId(pi_id);
|
|
|
baseDTO.setName(pi_class);
|
|
|
- //编号获取
|
|
|
pi_inoutno = pushMaxnubmer(baseDTO);
|
|
|
prodInOut.setPi_inoutno(pi_inoutno);
|
|
|
|
|
|
//判断更新与保存动作
|
|
|
if (StringUtils.isEmpty(pi_id) || "0".equals(pi_id.toString())){
|
|
|
+ prodInOut.setCompanyId(companyId);
|
|
|
+ setCreateInfo(prodInOut);
|
|
|
//插入操作
|
|
|
getMapper().insertSelective(prodInOut);
|
|
|
pi_id = prodInOut.getId();
|
|
|
@@ -177,19 +173,25 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
|
|
|
//日志记录
|
|
|
messageLogService.save(baseDTO);
|
|
|
return baseDTO;
|
|
|
+ }else{
|
|
|
+ setUpdateInfo(prodInOut);
|
|
|
}
|
|
|
//更新操作
|
|
|
getMapper().updateByPrimaryKeySelective(prodInOut);
|
|
|
//添加从表传输对象
|
|
|
for (ProdIODetailDTO item : items) {
|
|
|
ProdIODetail detail = BeanMapper.map(item, ProdIODetail.class);
|
|
|
- detail.setPd_piid(pi_id);
|
|
|
- detail.setPd_inoutno(pi_inoutno);
|
|
|
- detail.setPd_piclass(prodInOut.getPi_class());
|
|
|
- detail.setCompanyId(companyId);
|
|
|
- detail.setCreatorId(userId);
|
|
|
- detail.setCreateTime(new Date());
|
|
|
+ detail.setUpdaterId(userId);
|
|
|
+ detail.setUpdateTime(new Date());
|
|
|
+ detail.setUpdater(userName);
|
|
|
if (StringUtils.isEmpty(detail.getId()) || "0".equals(detail.getId().toString())) {
|
|
|
+ detail.setCompanyId(companyId);
|
|
|
+ detail.setCreatorId(userId);
|
|
|
+ detail.setCreateTime(new Date());
|
|
|
+
|
|
|
+ detail.setPd_piid(pi_id);
|
|
|
+ detail.setPd_inoutno(pi_inoutno);
|
|
|
+ detail.setPd_piclass(prodInOut.getPi_class());
|
|
|
insertDetails.add(detail);
|
|
|
} else {
|
|
|
updateDetails.add(detail);
|
|
|
@@ -272,6 +274,7 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
|
|
|
map.put("inoutNo",pi_inoutno);
|
|
|
map.put("class", pi_class);
|
|
|
map.put("commitid",BaseContextHolder.getUserId());
|
|
|
+ map.put("commitUser",BaseContextHolder.getUserName());
|
|
|
map.put("companyId",BaseContextHolder.getCompanyId());
|
|
|
map.put("result","");
|
|
|
Result res = warehouseApi.post(map);
|
|
|
@@ -416,6 +419,8 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
|
|
|
ProdInOut sourcePi = getMapper().selectByPrimaryKey(id);
|
|
|
Integer count=0;
|
|
|
double pdInqty=0, pdYqty=0;
|
|
|
+ Long userId = BaseContextHolder.getUserId();
|
|
|
+ String userName = BaseContextHolder.getUserName();
|
|
|
List<ProdIODetail> sourcePids =prodIODetailMapper.selectByFK(id);
|
|
|
//检查从表
|
|
|
for (ProdIODetail prodIODetail : sourcePids) {
|
|
|
@@ -447,6 +452,11 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
|
|
|
//设置公司id
|
|
|
targetPi.setCompanyId(sourcePi.getCompanyId());
|
|
|
targetPi.setCreateTime(new Date());
|
|
|
+ targetPi.setCreatorId(userId);
|
|
|
+ targetPi.setCreator(userName);
|
|
|
+ targetPi.setUpdaterId(userId);
|
|
|
+ targetPi.setUpdater(userName);
|
|
|
+ targetPi.setUpdateTime(new Date());
|
|
|
|
|
|
//保存数据
|
|
|
getMapper().insertSelective(targetPi);
|
|
|
@@ -479,7 +489,11 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
|
|
|
//公司id
|
|
|
targetPid.setCompanyId(sourcePid.getCompanyId());
|
|
|
targetPid.setCreateTime(new Date());
|
|
|
-
|
|
|
+ targetPid.setCreatorId(userId);
|
|
|
+ targetPid.setCreator(userName);
|
|
|
+ targetPid.setUpdaterId(userId);
|
|
|
+ targetPid.setUpdater(userName);
|
|
|
+ targetPid.setUpdateTime(new Date());
|
|
|
//本次转单数
|
|
|
targetPid.setPd_outqty(pdInqty-pdYqty);
|
|
|
prodIODetailMapper.insertSelective(targetPid);
|
|
|
@@ -508,6 +522,7 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
|
|
|
}
|
|
|
prodInOut.setPi_statuscode(Status.CLOSE.name());
|
|
|
prodInOut.setPi_status(Status.CLOSE.getDisplay());
|
|
|
+ setUpdateInfo(prodInOut);
|
|
|
getMapper().updateByPrimaryKeySelective(prodInOut);
|
|
|
docBaseDTO = getBaseDTOById(id,prodInOut.getPi_class(),prodInOut.getPi_inoutno());
|
|
|
//日志
|
|
|
@@ -542,6 +557,7 @@ public class ProdInOutServiceImpl extends CommonBaseServiceImpl<ProdInOutMapper,
|
|
|
}
|
|
|
prodInOut.setPi_statuscode(Status.OPEN.name());
|
|
|
prodInOut.setPi_status(Status.OPEN.getDisplay());
|
|
|
+ setUpdateInfo(prodInOut);
|
|
|
getMapper().updateByPrimaryKeySelective(prodInOut);
|
|
|
docBaseDTO = getBaseDTOById(id,prodInOut.getPi_class(),prodInOut.getPi_inoutno());
|
|
|
//日志
|