|
@@ -134,6 +134,8 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
|
|
|
private ApsScheduleLogService apsScheduleLogService;
|
|
|
@Autowired
|
|
|
private RedissonClient redissonClient;
|
|
|
+ @Autowired
|
|
|
+ private ApsCustomerManagementService apsCustomerManagementService;
|
|
|
|
|
|
|
|
|
@Override
|
|
@@ -4043,6 +4045,8 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
|
|
|
// if (ObjectUtil.isEmpty(req.getBatchNumbers())) {
|
|
|
// return R.error("批次号不可为空");
|
|
|
// }
|
|
|
+ SysUserVo currentUser = CXCommonUtils.getCurrentUser();
|
|
|
+ String tenantId = CXCommonUtils.getCurrentUserFactoryId(currentUser);
|
|
|
if (ObjectUtil.isEmpty(req.getBlankId())) {
|
|
|
return R.error("坯料计划ID为空");
|
|
|
}
|
|
@@ -4191,6 +4195,42 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
|
|
|
return R.error("批次号" + s + "错误,该料卷在加工中");
|
|
|
}
|
|
|
|
|
|
+ //如果(在制品状态=备料中或待加工,并且在制品对应订单不是本工厂),
|
|
|
+ // 或者(在制品状态=待入库或已入库或已出库,
|
|
|
+ // 并且在制品对应订单的(订单类型不是内部订单或者客户所属工厂不是本工厂)),
|
|
|
+ // 错误提示:该料卷不是本工厂在制品
|
|
|
+ if (Arrays.asList("备料中", "待加工").contains(apsWorkInProgressInventoryDo.getWorkinprocessstatus())
|
|
|
+ && !apsWorkInProgressInventoryDo.getTenantid().equals(tenantId)) {
|
|
|
+ log.error("批次号备料中或待加工,不是本工厂");
|
|
|
+ return R.error("批次号" + s + "不是本工厂在制品");
|
|
|
+ }
|
|
|
+ if (Arrays.asList("待入库", "已入库", "已出库").contains(apsWorkInProgressInventoryDo.getWorkinprocessstatus())) {
|
|
|
+ //客户所属工厂
|
|
|
+ String custonTenantId = "";
|
|
|
+ //订单号
|
|
|
+ String ordernumber = apsWorkInProgressInventoryDo.getOrdernumber();
|
|
|
+ if (ObjectUtil.isNotEmpty(ordernumber)) {
|
|
|
+ //根据订单号查询订单信息
|
|
|
+ ApsProductionOrderDo apsProductionOrderDo = apsProductionOrderService.getOne(new LambdaQueryWrapper<ApsProductionOrderDo>().eq(ApsProductionOrderDo::getOrderno, ordernumber));
|
|
|
+ //客户ID
|
|
|
+ String customid = apsProductionOrderDo.getCustomid();
|
|
|
+ if (ObjectUtil.isNotEmpty(customid)) {
|
|
|
+ //查询客户信息
|
|
|
+ ApsCustomerManagementDo apsCustomerManagementDo = apsCustomerManagementService.getById(customid);
|
|
|
+ if (ObjectUtil.isNotEmpty(apsCustomerManagementDo)) {
|
|
|
+ if (ObjectUtil.isNotEmpty(apsCustomerManagementDo.getManufactroy())) {
|
|
|
+ custonTenantId = apsCustomerManagementDo.getManufactroy();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!apsWorkInProgressInventoryDo.getOrdertype().equals("内部订单")
|
|
|
+ || !custonTenantId.equals(tenantId)) {
|
|
|
+ log.error("批次号待入库或已入库或已出库,不是本工厂");
|
|
|
+ return R.error("批次号" + s + "不是本工厂在制品");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
//如果在制品状态=待入库或已入库或已出库,并且在制品的订单号对应订单的订单类型=客户订单,错误提示:批次号{批次号}错误,该料卷是其他客户订单的成品
|
|
|
if (Arrays.asList("待入库", "已入库", "已出库").contains(apsWorkInProgressInventoryDo.getWorkinprocessstatus())) {
|
|
|
if (ObjectUtil.isNotEmpty(apsWorkInProgressInventoryDo.getOrdertype()) && apsWorkInProgressInventoryDo.getOrdertype().equals("客户订单")) {
|