|
|
@ -4,6 +4,7 @@ import com.glxp.sale.admin.config.WebSocketServer;
|
|
|
|
import com.glxp.sale.admin.constant.Constant;
|
|
|
|
import com.glxp.sale.admin.constant.Constant;
|
|
|
|
import com.glxp.sale.admin.constant.ConstantStatus;
|
|
|
|
import com.glxp.sale.admin.constant.ConstantStatus;
|
|
|
|
import com.glxp.sale.admin.constant.ConstantType;
|
|
|
|
import com.glxp.sale.admin.constant.ConstantType;
|
|
|
|
|
|
|
|
import com.glxp.sale.admin.controller.inout.utils.CheckOrderUtils;
|
|
|
|
import com.glxp.sale.admin.controller.inout.utils.ContrastErpUtil;
|
|
|
|
import com.glxp.sale.admin.controller.inout.utils.ContrastErpUtil;
|
|
|
|
import com.glxp.sale.admin.controller.inout.utils.DataTransUtil;
|
|
|
|
import com.glxp.sale.admin.controller.inout.utils.DataTransUtil;
|
|
|
|
import com.glxp.sale.admin.controller.inout.utils.InoutUtils;
|
|
|
|
import com.glxp.sale.admin.controller.inout.utils.InoutUtils;
|
|
|
@ -91,7 +92,8 @@ public class IoTransInoutService {
|
|
|
|
CompanyService companyService;
|
|
|
|
CompanyService companyService;
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
InvWarehouseService invWarehouseService;
|
|
|
|
InvWarehouseService invWarehouseService;
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private CheckOrderUtils checkOrderUtils;
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
InvProductDetailService invProductDetailService;
|
|
|
|
InvProductDetailService invProductDetailService;
|
|
|
|
|
|
|
|
|
|
|
@ -241,9 +243,19 @@ public class IoTransInoutService {
|
|
|
|
orderEntity.setStatus(ConstantStatus.ORDER_STATUS_FAIL);
|
|
|
|
orderEntity.setStatus(ConstantStatus.ORDER_STATUS_FAIL);
|
|
|
|
orderService.updateOrder(orderEntity);
|
|
|
|
orderService.updateOrder(orderEntity);
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
} else if (orderEntity.getFromCorpId() == null) {
|
|
|
|
|
|
|
|
BasicUnitMaintainEntity basicUnitMaintainEntity = basicUnitMaintainService.selectByName(orderEntity.getFromCorp());
|
|
|
|
|
|
|
|
if (basicUnitMaintainEntity == null) {
|
|
|
|
|
|
|
|
orderEntity.setRemark("未选择往来单位");
|
|
|
|
|
|
|
|
orderEntity.setStatus(ConstantStatus.ORDER_STATUS_FAIL);
|
|
|
|
|
|
|
|
orderService.updateOrder(orderEntity);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
orderEntity.setFromCorpId(basicUnitMaintainEntity.getErpId());
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
BussinessTypeEntity bussinessTypeEntity = bussinessTypeService.findBTByAction(orderEntity.getAction());
|
|
|
|
BussinessTypeEntity bussinessTypeEntity = bussinessTypeService.findBTByAction(orderEntity.getAction());
|
|
|
|
if (bussinessTypeEntity.isGenUnit()) {
|
|
|
|
if (bussinessTypeEntity.getCorpType() == ConstantStatus.CORP_TYPE_INPUT) {
|
|
|
|
BasicUnitMaintainEntity basicUnitMaintainEntity = new BasicUnitMaintainEntity();
|
|
|
|
BasicUnitMaintainEntity basicUnitMaintainEntity = new BasicUnitMaintainEntity();
|
|
|
|
basicUnitMaintainEntity.setErpId(CustomUtil.getUnitId());
|
|
|
|
basicUnitMaintainEntity.setErpId(CustomUtil.getUnitId());
|
|
|
|
basicUnitMaintainEntity.setCorpType(ConstantStatus.CORP_SICK);
|
|
|
|
basicUnitMaintainEntity.setCorpType(ConstantStatus.CORP_SICK);
|
|
|
@ -437,9 +449,10 @@ public class IoTransInoutService {
|
|
|
|
orderEntity.setStatus(ConstantStatus.ORDER_STATUS_SUCCESS);
|
|
|
|
orderEntity.setStatus(ConstantStatus.ORDER_STATUS_SUCCESS);
|
|
|
|
orderService.updateOrder(orderEntity);
|
|
|
|
orderService.updateOrder(orderEntity);
|
|
|
|
// orderService.updateOrderStatus(orderEntity.getId(), ConstantStatus.ORDER_STATUS_SUCCESS);
|
|
|
|
// orderService.updateOrderStatus(orderEntity.getId(), ConstantStatus.ORDER_STATUS_SUCCESS);
|
|
|
|
if (orderEntity.getCustomerId().equals(Constant.SYSTEM_CUSTOMER_ID)) {
|
|
|
|
// if (orderEntity.getCustomerId() == null && orderEntity.getCustomerId().equals(Constant.SYSTEM_CUSTOMER_ID)) {
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// }
|
|
|
|
invProductsTrService.genInvProducts(orderEntity.getId());
|
|
|
|
invProductsTrService.genInvProducts(orderEntity.getId());
|
|
|
|
}
|
|
|
|
|
|
|
|
printOrder(orderEntity.getId());
|
|
|
|
printOrder(orderEntity.getId());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -490,6 +503,7 @@ public class IoTransInoutService {
|
|
|
|
FilterErpOrderRequest filterErpOrderRequest = new FilterErpOrderRequest();
|
|
|
|
FilterErpOrderRequest filterErpOrderRequest = new FilterErpOrderRequest();
|
|
|
|
filterErpOrderRequest.setOrderId(orderId);
|
|
|
|
filterErpOrderRequest.setOrderId(orderId);
|
|
|
|
List<ErpOrderEntity> erpOrderEntities = myErpOrderService.filterAllMyErpOrder(filterErpOrderRequest);
|
|
|
|
List<ErpOrderEntity> erpOrderEntities = myErpOrderService.filterAllMyErpOrder(filterErpOrderRequest);
|
|
|
|
|
|
|
|
int checkStatus = ConstantStatus.ORDER_STATUS_CHECK;
|
|
|
|
if (erpOrderEntities != null && erpOrderEntities.size() > 0) {
|
|
|
|
if (erpOrderEntities != null && erpOrderEntities.size() > 0) {
|
|
|
|
for (ErpOrderEntity erpOrderEntity : erpOrderEntities) {
|
|
|
|
for (ErpOrderEntity erpOrderEntity : erpOrderEntities) {
|
|
|
|
|
|
|
|
|
|
|
@ -498,9 +512,11 @@ public class IoTransInoutService {
|
|
|
|
filterUdiInfoRequest.setNameCode(erpOrderEntity.getNameCode());
|
|
|
|
filterUdiInfoRequest.setNameCode(erpOrderEntity.getNameCode());
|
|
|
|
List<UdiRelevanceResponse> udiRelevanceEntities = udiRelevanceService.filterUdiRelevance(filterUdiInfoRequest);
|
|
|
|
List<UdiRelevanceResponse> udiRelevanceEntities = udiRelevanceService.filterUdiRelevance(filterUdiInfoRequest);
|
|
|
|
if (udiRelevanceEntities != null && udiRelevanceEntities.size() > 1 && erpOrderEntity.getBindRlFk() == null) {
|
|
|
|
if (udiRelevanceEntities != null && udiRelevanceEntities.size() > 1 && erpOrderEntity.getBindRlFk() == null) {
|
|
|
|
|
|
|
|
|
|
|
|
erpOrderEntity.setBindStatus(ConstantStatus.ORDER_DETAIL_DI_MUTI);
|
|
|
|
erpOrderEntity.setBindStatus(ConstantStatus.ORDER_DETAIL_DI_MUTI);
|
|
|
|
myErpOrderService.updateErpOrder(erpOrderEntity);
|
|
|
|
myErpOrderService.updateErpOrder(erpOrderEntity);
|
|
|
|
orderEntity.setRemark("该产品DI绑定多个产品ID,请在扫码单据详情绑定对应产品ID");
|
|
|
|
orderEntity.setRemark("该产品DI绑定多个产品ID,请在扫码单据详情绑定对应产品ID");
|
|
|
|
|
|
|
|
checkStatus = ConstantStatus.ORDER_CHECK_FAIL;
|
|
|
|
orderEntity.setContrastStatus(ConstantStatus.ORDER_CHECK_FAIL);
|
|
|
|
orderEntity.setContrastStatus(ConstantStatus.ORDER_CHECK_FAIL);
|
|
|
|
orderEntity.setStatus(ConstantStatus.ORDER_STATUS_SUCCESS);
|
|
|
|
orderEntity.setStatus(ConstantStatus.ORDER_STATUS_SUCCESS);
|
|
|
|
orderService.updateOrder(orderEntity);
|
|
|
|
orderService.updateOrder(orderEntity);
|
|
|
@ -513,15 +529,34 @@ public class IoTransInoutService {
|
|
|
|
erpOrderEntity.setBindStatus(ConstantStatus.ORDER_DETAIL_SUP_MUTI);
|
|
|
|
erpOrderEntity.setBindStatus(ConstantStatus.ORDER_DETAIL_SUP_MUTI);
|
|
|
|
orderEntity.setRemark("该产品绑定多个供应商");
|
|
|
|
orderEntity.setRemark("该产品绑定多个供应商");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
checkStatus = ConstantStatus.ORDER_CHECK_FAIL;
|
|
|
|
orderEntity.setContrastStatus(ConstantStatus.ORDER_CHECK_FAIL);
|
|
|
|
orderEntity.setContrastStatus(ConstantStatus.ORDER_CHECK_FAIL);
|
|
|
|
orderEntity.setStatus(ConstantStatus.ORDER_STATUS_SUCCESS);
|
|
|
|
orderEntity.setStatus(ConstantStatus.ORDER_STATUS_SUCCESS);
|
|
|
|
orderService.updateOrder(orderEntity);
|
|
|
|
orderService.updateOrder(orderEntity);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
orderEntity.setContrastStatus(ConstantStatus.ORDER_CHECK_UN);
|
|
|
|
if (bussinessTypeEntity.getCorpType() != ConstantStatus.CORP_TYPE_INNOR) {
|
|
|
|
|
|
|
|
CompanyProductRelevanceEntity companyProductRelevanceEntity = companyProductRelevanceService.findByUdiRlIdUnitFk(erpOrderEntity.getBindRlFk(), erpOrderEntity.getSupId());
|
|
|
|
|
|
|
|
if (companyProductRelevanceEntity == null) {
|
|
|
|
|
|
|
|
orderEntity.setRemark(erpOrderEntity.getCoName() + "该产品非此供应商配送");
|
|
|
|
|
|
|
|
checkStatus = ConstantStatus.ORDER_CHECK_FAIL;
|
|
|
|
|
|
|
|
orderEntity.setContrastStatus(ConstantStatus.ORDER_CHECK_FAIL);
|
|
|
|
|
|
|
|
orderEntity.setStatus(ConstantStatus.ORDER_STATUS_SUCCESS);
|
|
|
|
|
|
|
|
orderService.updateOrder(orderEntity);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
orderEntity.setContrastStatus(checkStatus);
|
|
|
|
|
|
|
|
orderEntity.setStatus(ConstantStatus.ORDER_STATUS_CHECK);
|
|
|
|
|
|
|
|
orderService.updateOrder(orderEntity);
|
|
|
|
|
|
|
|
erpOrderEntity.setBindStatus(ConstantStatus.ORDER_DETAIL_SUP_ONE);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
orderEntity.setContrastStatus(checkStatus);
|
|
|
|
orderEntity.setStatus(ConstantStatus.ORDER_STATUS_CHECK);
|
|
|
|
orderEntity.setStatus(ConstantStatus.ORDER_STATUS_CHECK);
|
|
|
|
orderService.updateOrder(orderEntity);
|
|
|
|
orderService.updateOrder(orderEntity);
|
|
|
|
erpOrderEntity.setBindStatus(ConstantStatus.ORDER_DETAIL_SUP_ONE);
|
|
|
|
erpOrderEntity.setBindStatus(ConstantStatus.ORDER_DETAIL_SUP_ONE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
myErpOrderService.updateErpOrder(erpOrderEntity);
|
|
|
|
myErpOrderService.updateErpOrder(erpOrderEntity);
|
|
|
|
|
|
|
|
|
|
|
@ -532,6 +567,12 @@ public class IoTransInoutService {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void updateSuccess(OrderEntity orderEntity, int checkStatus, int status, String remark) {
|
|
|
|
|
|
|
|
orderEntity.setContrastStatus(ConstantStatus.ORDER_CHECK_UN);
|
|
|
|
|
|
|
|
orderEntity.setStatus(ConstantStatus.ORDER_STATUS_CHECK);
|
|
|
|
|
|
|
|
orderService.updateOrder(orderEntity);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// //校验ERP单
|
|
|
|
// //校验ERP单
|
|
|
|
@Async
|
|
|
|
@Async
|
|
|
@ -554,26 +595,25 @@ public class IoTransInoutService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void checkOrder(OrderEntity orderEntity) {
|
|
|
|
public void checkOrder(OrderEntity orderEntity) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
orderEntity = orderService.findById(orderEntity.getId());
|
|
|
|
orderEntity = orderService.findById(orderEntity.getId());
|
|
|
|
List<String> erpIds = DataTransUtil.strToErpList(orderEntity.getErpFk());
|
|
|
|
List<String> erpIds = DataTransUtil.strToErpList(orderEntity.getErpFk());
|
|
|
|
List<WarehouseEntity> transData = warehouseService.findByReceiptId(orderEntity.getId());
|
|
|
|
List<WarehouseEntity> transData = warehouseService.findByReceiptId(orderEntity.getId());
|
|
|
|
|
|
|
|
myErpOrderService.deleteByOrderId(orderEntity.getId());
|
|
|
|
|
|
|
|
genOrderDetail(transData);
|
|
|
|
if (erpIds != null && erpIds.size() > 0) {
|
|
|
|
if (erpIds != null && erpIds.size() > 0) {
|
|
|
|
List<ErpOrderEntity> erpOrderEntities = thrDataService.getStockOrders(erpIds);
|
|
|
|
List<ErpOrderEntity> erpOrderEntities = thrDataService.getStockOrders(erpIds);
|
|
|
|
checkThirdOrder(erpOrderEntities, orderEntity, transData);
|
|
|
|
checkOrderUtils.check(orderEntity.getId(), erpOrderEntities);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
orderEntity.setContrastStatus(ConstantStatus.ORDER_CHECK_UN);
|
|
|
|
// orderEntity.setContrastStatus(ConstantStatus.ORDER_CHECK_UN);
|
|
|
|
orderEntity.setStatus(ConstantStatus.ORDER_STATUS_SUCCESS);
|
|
|
|
// orderEntity.setStatus(ConstantStatus.ORDER_STATUS_SUCCESS);
|
|
|
|
orderEntity.setRemark("未选入第三方出入库单据进行校验,请手动选择");
|
|
|
|
// orderEntity.setRemark("未选入第三方出入库单据进行校验,请手动选择");
|
|
|
|
orderService.updateOrder(orderEntity);
|
|
|
|
// orderService.updateOrder(orderEntity);
|
|
|
|
myErpOrderService.deleteByOrderId(orderEntity.getId());
|
|
|
|
// myErpOrderService.deleteByOrderId(orderEntity.getId());
|
|
|
|
new InoutUtils(udiUrl).generateConstrastDetail(udiInfoService, udiRelevanceService, myErpOrderService, transData);
|
|
|
|
// new InoutUtils(udiUrl).generateConstrastDetail(udiInfoService, udiRelevanceService, myErpOrderService, transData);
|
|
|
|
printOrder(orderEntity.getId());
|
|
|
|
// printOrder(orderEntity.getId());
|
|
|
|
if (orderEntity.getCustomerId().equals(Constant.SYSTEM_CUSTOMER_ID)) {
|
|
|
|
// if (orderEntity.getCustomerId().equals(Constant.SYSTEM_CUSTOMER_ID)) {
|
|
|
|
invProductsTrService.genInvProducts(orderEntity.getId());
|
|
|
|
// invProductsTrService.genInvProducts(orderEntity.getId());
|
|
|
|
}
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -635,6 +675,7 @@ public class IoTransInoutService {
|
|
|
|
|
|
|
|
|
|
|
|
public void syncprintOrder(String orderId) {
|
|
|
|
public void syncprintOrder(String orderId) {
|
|
|
|
OrderEntity orderEntity = orderService.findById(orderId);
|
|
|
|
OrderEntity orderEntity = orderService.findById(orderId);
|
|
|
|
|
|
|
|
BussinessTypeEntity bussinessTypeEntity = bussinessTypeService.findBTByAction(orderEntity.getAction());
|
|
|
|
if (orderEntity.getStatus() == ConstantStatus.ORDER_STATUS_SUCCESS && orderEntity.getErpFk() == null
|
|
|
|
if (orderEntity.getStatus() == ConstantStatus.ORDER_STATUS_SUCCESS && orderEntity.getErpFk() == null
|
|
|
|
) {
|
|
|
|
) {
|
|
|
|
|
|
|
|
|
|
|
@ -642,7 +683,7 @@ public class IoTransInoutService {
|
|
|
|
FilterErpOrderRequest filterErpOrderRequest = new FilterErpOrderRequest();
|
|
|
|
FilterErpOrderRequest filterErpOrderRequest = new FilterErpOrderRequest();
|
|
|
|
filterErpOrderRequest.setOrderId(orderId);
|
|
|
|
filterErpOrderRequest.setOrderId(orderId);
|
|
|
|
List<ErpOrderEntity> erpOrderEntities = myErpOrderService.filterAllMyErpOrder(filterErpOrderRequest);
|
|
|
|
List<ErpOrderEntity> erpOrderEntities = myErpOrderService.filterAllMyErpOrder(filterErpOrderRequest);
|
|
|
|
BussinessTypeEntity bussinessTypeEntity = bussinessTypeService.findBTByAction(orderEntity.getAction());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//生成业务单据详情
|
|
|
|
//生成业务单据详情
|
|
|
|
List<StockOrderDetailEntity> stockOrderDetailEntities = new ArrayList<>();
|
|
|
|
List<StockOrderDetailEntity> stockOrderDetailEntities = new ArrayList<>();
|
|
|
@ -722,7 +763,7 @@ public class IoTransInoutService {
|
|
|
|
StockOrderFilterRequest stockOrderFilterRequest = new StockOrderFilterRequest();
|
|
|
|
StockOrderFilterRequest stockOrderFilterRequest = new StockOrderFilterRequest();
|
|
|
|
stockOrderFilterRequest.setBillNo(erpIds[i]);
|
|
|
|
stockOrderFilterRequest.setBillNo(erpIds[i]);
|
|
|
|
StockOrderEntity stockOrderEntity = stockOrderService.findOne(stockOrderFilterRequest);
|
|
|
|
StockOrderEntity stockOrderEntity = stockOrderService.findOne(stockOrderFilterRequest);
|
|
|
|
stockOrderEntity.setStatus(ConstantStatus.SORDER_CHECKED);
|
|
|
|
stockOrderEntity.setStatus(new CheckOrderUtils().getStockOrderStatus(orderEntity, bussinessTypeEntity));
|
|
|
|
stockOrderService.updateById(stockOrderEntity);
|
|
|
|
stockOrderService.updateById(stockOrderEntity);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|