fix(102、532、262):新增表逻辑
This commit is contained in:
parent
08e4d98042
commit
c7083bf010
@ -13,4 +13,9 @@ public class CustomizeResponse {
|
||||
private JSONObject objectResponse;
|
||||
|
||||
private JSONArray arrayResponse;
|
||||
|
||||
/**
|
||||
* 同步單號
|
||||
*/
|
||||
private String syncVoucherNo;
|
||||
}
|
||||
|
||||
@ -12,14 +12,8 @@ import com.foreverwin.iep.integration.service.IntInDataLogService;
|
||||
import com.foreverwin.iep.integration.service.IntInDataService;
|
||||
import com.foreverwin.iep.integration.service.LotMaterialDealSendSapService;
|
||||
import com.foreverwin.iep.integration.service.RegisterDocumentService;
|
||||
import com.foreverwin.iep.prd.entity.ZLotMaterialCancel;
|
||||
import com.foreverwin.iep.prd.entity.ZLotMaterialCompleteTransaction;
|
||||
import com.foreverwin.iep.prd.entity.ZLotMaterialConsumptionTransaction;
|
||||
import com.foreverwin.iep.prd.entity.ZShoporderStatisticsTransaction;
|
||||
import com.foreverwin.iep.prd.mapper.ZLotMaterialCancelMapper;
|
||||
import com.foreverwin.iep.prd.mapper.ZLotMaterialCompleteTransactionMapper;
|
||||
import com.foreverwin.iep.prd.mapper.ZLotMaterialConsumptionTransactionMapper;
|
||||
import com.foreverwin.iep.prd.mapper.ZShoporderStatisticsTransactionMapper;
|
||||
import com.foreverwin.iep.prd.entity.*;
|
||||
import com.foreverwin.iep.prd.mapper.*;
|
||||
import com.foreverwin.iep.wip.entity.LotMaterial;
|
||||
import com.foreverwin.iep.wip.mapper.LotMaterialMapper;
|
||||
import com.foreverwin.mom.common.core.exception.BusinessException;
|
||||
@ -31,6 +25,7 @@ import com.foreverwin.mom.common.security.util.SecurityUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
@ -44,6 +39,7 @@ import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
@ -72,6 +68,10 @@ public class ShopOrderStatisticTransController {
|
||||
|
||||
private final ZLotMaterialCancelMapper zLotMaterialCancelMapper;
|
||||
|
||||
private final ZLotMaterialCompleteTransactionOffMapper zLotMaterialCompleteTransactionOffMapper;
|
||||
|
||||
private final ZLotMaterialConsumptionTransactionOffMapper zLotMaterialConsumptionTransactionOffMapper;
|
||||
|
||||
@Autowired
|
||||
@Qualifier("ZMM_MES_GOODMVT_REVERSE") // 通过 Bean 名称注入
|
||||
private GoodMvtReverseService goodMvtReverseService;
|
||||
@ -368,6 +368,8 @@ public class ShopOrderStatisticTransController {
|
||||
@SysLog("生产管理报工平台-物料消耗冲销")
|
||||
@PostMapping("/callErpLotCancel")
|
||||
public R callErpLotCancel(@RequestBody List<ZLotMaterialConsumptionTransaction> lotMaterialConsumptionTransactions) {
|
||||
String user = SecurityUtils.getUserName();
|
||||
LocalDateTime localDateTime = LocalDateTime.now();
|
||||
for (ZLotMaterialConsumptionTransaction consumptionTransaction : lotMaterialConsumptionTransactions) {
|
||||
ZLotMaterialCancel zLotMaterialCancel = zLotMaterialCancelMapper.selectById(consumptionTransaction.getSid());
|
||||
if (zLotMaterialCancel != null) {
|
||||
@ -385,14 +387,27 @@ public class ShopOrderStatisticTransController {
|
||||
// 更新lotMaterial表
|
||||
targetObj.setErpReverse("Y");
|
||||
targetObj.setSyncStatus("C");
|
||||
targetObj.setUpdater(SecurityUtils.getUserName());
|
||||
targetObj.setDateUpdate(LocalDateTime.now());
|
||||
targetObj.setUpdater(user);
|
||||
targetObj.setDateUpdate(localDateTime);
|
||||
zLotMaterialConsumptionTransactionMapper.updateById(targetObj);
|
||||
LotMaterial lotMaterial = lotMaterialMapper.selectById(targetObj.getLotMaterialSid());
|
||||
if (lotMaterial != null) {
|
||||
lotMaterial.setErpFlag("N");
|
||||
lotMaterialMapper.updateById(lotMaterial);
|
||||
}
|
||||
// 添加物料消耗冲销事务表(262)
|
||||
ZLotMaterialConsumptionTransactionOff zLotMaterialConsumptionTransactionOff = new ZLotMaterialConsumptionTransactionOff();
|
||||
// 属性copy
|
||||
BeanUtils.copyProperties(targetObj, zLotMaterialConsumptionTransactionOff);
|
||||
zLotMaterialConsumptionTransactionOff.setZLotMaterialConsumptionTransactionSid(targetObj.getSid());
|
||||
zLotMaterialConsumptionTransactionOff.setSyncStatus(invokeResponse.getResult());
|
||||
zLotMaterialConsumptionTransactionOff.setSyncMsgText(invokeResponse.getMessageContent());
|
||||
zLotMaterialConsumptionTransactionOff.setSyncVoucherNo(invokeResponse.getSyncVoucherNo());
|
||||
zLotMaterialConsumptionTransactionOff.setCreator(user);
|
||||
zLotMaterialConsumptionTransactionOff.setDateCreate(localDateTime);
|
||||
zLotMaterialConsumptionTransactionOff.setUpdater(user);
|
||||
zLotMaterialConsumptionTransactionOff.setDateUpdate(localDateTime);
|
||||
zLotMaterialConsumptionTransactionOffMapper.insert(zLotMaterialConsumptionTransactionOff);
|
||||
}
|
||||
} else {
|
||||
throw BusinessException.build("批次" + targetObj.getLotNo() + "还未报工,不可冲销");
|
||||
@ -405,6 +420,8 @@ public class ShopOrderStatisticTransController {
|
||||
@SysLog("生产管理报工平台-完工入库冲销")
|
||||
@PostMapping("/callErpLotInStockCancel")
|
||||
public R callErpLotInStockCancel(@RequestBody List<ZLotMaterialCompleteTransaction> lotMaterialCompleteTransactions) {
|
||||
String user = SecurityUtils.getUserName();
|
||||
LocalDateTime localDateTime = LocalDateTime.now();
|
||||
for (ZLotMaterialCompleteTransaction completeTransaction : lotMaterialCompleteTransactions) {
|
||||
// 重新校验一遍是否已经报过工,防止重复报工
|
||||
ZLotMaterialCompleteTransaction targetObj = zLotMaterialCompleteTransactionMapper.selectById(completeTransaction.getSid());
|
||||
@ -418,9 +435,27 @@ public class ShopOrderStatisticTransController {
|
||||
// 更新冲销标识
|
||||
targetObj.setErpReverse("Y");
|
||||
targetObj.setSyncStatus("C");
|
||||
targetObj.setUpdater(SecurityUtils.getUserName());
|
||||
targetObj.setDateUpdate(LocalDateTime.now());
|
||||
targetObj.setUpdater(user);
|
||||
targetObj.setDateUpdate(localDateTime);
|
||||
zLotMaterialCompleteTransactionMapper.updateById(targetObj);
|
||||
// 添加完工入库冲销事务表(102、532)
|
||||
ZLotMaterialCompleteTransactionOff zLotMaterialCompleteTransactionOff = new ZLotMaterialCompleteTransactionOff();
|
||||
// 属性copy
|
||||
BeanUtils.copyProperties(targetObj, zLotMaterialCompleteTransactionOff);
|
||||
if (Objects.equals("101",targetObj.getProductType())) {
|
||||
zLotMaterialCompleteTransactionOff.setProductType("102");
|
||||
} else if (Objects.equals("531",targetObj.getProductType())) {
|
||||
zLotMaterialCompleteTransactionOff.setProductType("532");
|
||||
}
|
||||
zLotMaterialCompleteTransactionOff.setZLotMaterialCompleteTransactionSid(targetObj.getSid());
|
||||
zLotMaterialCompleteTransactionOff.setSyncStatus(invokeResponse.getResult());
|
||||
zLotMaterialCompleteTransactionOff.setSyncMsgText(invokeResponse.getMessageContent());
|
||||
zLotMaterialCompleteTransactionOff.setSyncVoucherNo(invokeResponse.getSyncVoucherNo());
|
||||
zLotMaterialCompleteTransactionOff.setCreator(user);
|
||||
zLotMaterialCompleteTransactionOff.setDateCreate(localDateTime);
|
||||
zLotMaterialCompleteTransactionOff.setUpdater(user);
|
||||
zLotMaterialCompleteTransactionOff.setDateUpdate(localDateTime);
|
||||
zLotMaterialCompleteTransactionOffMapper.insert(zLotMaterialCompleteTransactionOff);
|
||||
}
|
||||
} else {
|
||||
throw BusinessException.build("批次" + targetObj.getLotNo() + "还未报工,不可冲销");
|
||||
|
||||
@ -47,6 +47,9 @@ public class GoodMvtReverseService implements HandlerService {
|
||||
status = !"S".equals(result) ? "E" : result;
|
||||
String message = outJson.getString("MSGTX");
|
||||
invokeResponse.setMessageContent(StringUtils.isEmpty(message) ? "成功" : message);
|
||||
// 凭证
|
||||
String syncVoucherNo = outJson.getString("MBLNR");
|
||||
invokeResponse.setSyncVoucherNo(syncVoucherNo);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
status = "E";
|
||||
|
||||
Loading…
Reference in New Issue
Block a user