|
|
@ -37,6 +37,7 @@ import com.glxp.sale.admin.service.param.SystemParamConfigService;
|
|
|
|
import com.glxp.sale.admin.service.thrsys.ThrDataService;
|
|
|
|
import com.glxp.sale.admin.service.thrsys.ThrDataService;
|
|
|
|
import com.glxp.sale.admin.service.thrsys.ThrOrderService;
|
|
|
|
import com.glxp.sale.admin.service.thrsys.ThrOrderService;
|
|
|
|
import com.glxp.sale.admin.util.CustomUtil;
|
|
|
|
import com.glxp.sale.admin.util.CustomUtil;
|
|
|
|
|
|
|
|
import com.glxp.sale.admin.util.DateUtil;
|
|
|
|
import com.glxp.sale.admin.util.FilterUdiUtils;
|
|
|
|
import com.glxp.sale.admin.util.FilterUdiUtils;
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
import org.slf4j.Logger;
|
|
|
|
import org.slf4j.Logger;
|
|
|
@ -44,6 +45,7 @@ import org.slf4j.LoggerFactory;
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
|
|
|
|
|
import org.springframework.context.annotation.Bean;
|
|
|
|
import org.springframework.context.annotation.Lazy;
|
|
|
|
import org.springframework.context.annotation.Lazy;
|
|
|
|
import org.springframework.scheduling.annotation.Async;
|
|
|
|
import org.springframework.scheduling.annotation.Async;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
@ -171,8 +173,8 @@ public class IoTransInoutService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
WarehouseEntity warehouseEntity = warehouseEntityList.get(0);
|
|
|
|
WarehouseEntity warehouseEntity = warehouseEntityList.get(0);
|
|
|
|
String orderId = "SM"+
|
|
|
|
String orderId = "SM" +
|
|
|
|
System.currentTimeMillis() + i + "";
|
|
|
|
CustomUtil.getId() + i + "";
|
|
|
|
OrderEntity orderSaveRequest = new OrderEntity();
|
|
|
|
OrderEntity orderSaveRequest = new OrderEntity();
|
|
|
|
orderSaveRequest.setId(orderId);
|
|
|
|
orderSaveRequest.setId(orderId);
|
|
|
|
if (warehouseEntity.getActDate() != null) {
|
|
|
|
if (warehouseEntity.getActDate() != null) {
|
|
|
@ -219,6 +221,50 @@ public class IoTransInoutService {
|
|
|
|
|
|
|
|
|
|
|
|
@Async
|
|
|
|
@Async
|
|
|
|
public void createOrderUdims(PostUdimsOrderRequest postUdimsOrderRequest) {
|
|
|
|
public void createOrderUdims(PostUdimsOrderRequest postUdimsOrderRequest) {
|
|
|
|
|
|
|
|
CompanyEntity companyEntity = companyService.findCompany(Long.parseLong(postUdimsOrderRequest.getCustomerId()));
|
|
|
|
|
|
|
|
List<PostUdimsOrderRequest.OrderBean> orderBeans = postUdimsOrderRequest.getOrderBeans();
|
|
|
|
|
|
|
|
if (orderBeans != null) {
|
|
|
|
|
|
|
|
for (PostUdimsOrderRequest.OrderBean orderBean : orderBeans) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
OrderEntity orderEntity = new OrderEntity();
|
|
|
|
|
|
|
|
String orderId = "SM" +
|
|
|
|
|
|
|
|
CustomUtil.getId() + "";
|
|
|
|
|
|
|
|
BeanUtils.copyProperties(orderBean, orderEntity);
|
|
|
|
|
|
|
|
orderEntity.setCorpOrderId(orderBean.getOrderId());
|
|
|
|
|
|
|
|
orderEntity.setFromCorpId(companyEntity.getUnitIdFk());
|
|
|
|
|
|
|
|
orderEntity.setFromCorp(companyEntity.getCompanyName());
|
|
|
|
|
|
|
|
orderEntity.setFromType(ConstantStatus.FROM_UDIMS);
|
|
|
|
|
|
|
|
orderEntity.setReceiveStatus(0);
|
|
|
|
|
|
|
|
orderEntity.setId(orderId);
|
|
|
|
|
|
|
|
orderEntity.setAction(ConstantType.TYPE_PUT);
|
|
|
|
|
|
|
|
orderEntity.setAction("SC54593439742");
|
|
|
|
|
|
|
|
orderEntity.setActDate(DateUtil.getDate());
|
|
|
|
|
|
|
|
orderEntity.setStatus(ConstantStatus.ORDER_STATUS_PROCESS);
|
|
|
|
|
|
|
|
orderEntity.setExportStatus(ConstantStatus.ORDER_EXPORT_UN);
|
|
|
|
|
|
|
|
orderEntity.setContrastStatus(ConstantStatus.ORDER_CHECK_UN);
|
|
|
|
|
|
|
|
orderEntity.setSignStatus(ConstantStatus.ORDER_SIGN_UN);
|
|
|
|
|
|
|
|
orderService.insertOrder(orderEntity);
|
|
|
|
|
|
|
|
List<PostUdimsOrderRequest.OrderBean.CodeBean> codeBeans = orderBean.getCodes();
|
|
|
|
|
|
|
|
List<WarehouseEntity> warehouseEntities = new ArrayList<>();
|
|
|
|
|
|
|
|
for (PostUdimsOrderRequest.OrderBean.CodeBean codeBean : codeBeans) {
|
|
|
|
|
|
|
|
WarehouseEntity warehouseEntity = new WarehouseEntity();
|
|
|
|
|
|
|
|
BeanUtils.copyProperties(codeBean, warehouseEntity);
|
|
|
|
|
|
|
|
warehouseEntity.setFromCorp(companyEntity.getCompanyName());
|
|
|
|
|
|
|
|
warehouseEntity.setFromCorpId(companyEntity.getUnitIdFk());
|
|
|
|
|
|
|
|
InvWarehouseEntity invWarehouseEntity = invWarehouseService.findDefault(false, true);
|
|
|
|
|
|
|
|
warehouseEntity.setLocStorageCode(invWarehouseEntity.getCode());
|
|
|
|
|
|
|
|
warehouseEntity.setOrderId(orderId);
|
|
|
|
|
|
|
|
warehouseEntities.add(warehouseEntity);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
for (WarehouseEntity temp : warehouseEntities) {
|
|
|
|
|
|
|
|
UdiEntity udiEntity = FilterUdiUtils.getUdi(temp.getCode());
|
|
|
|
|
|
|
|
temp.setNameCode(udiEntity.getUdi());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
codesTempService.insertCodesTemp(warehouseEntities);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -244,13 +290,23 @@ public class IoTransInoutService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void transInout(OrderEntity orderEntity) {
|
|
|
|
public void transInout(OrderEntity orderEntity) {
|
|
|
|
|
|
|
|
BussinessTypeEntity bussinessTypeEntity = bussinessTypeService.findBTByAction(orderEntity.getAction());
|
|
|
|
if (orderEntity.getFromCorp() == null) {
|
|
|
|
if (orderEntity.getFromCorp() == null) {
|
|
|
|
orderEntity.setRemark("未选择往来单位");
|
|
|
|
orderEntity.setRemark("未选择往来单位");
|
|
|
|
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) {
|
|
|
|
} else if (orderEntity.getFromCorpId() == null) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (bussinessTypeEntity.getCorpType() == ConstantStatus.CORP_TYPE_INPUT) {
|
|
|
|
|
|
|
|
BasicUnitMaintainEntity basicUnitMaintainEntity = new BasicUnitMaintainEntity();
|
|
|
|
|
|
|
|
basicUnitMaintainEntity.setErpId(CustomUtil.getUnitId());
|
|
|
|
|
|
|
|
basicUnitMaintainEntity.setCorpType(ConstantStatus.CORP_SICK);
|
|
|
|
|
|
|
|
basicUnitMaintainEntity.setName(orderEntity.getFromCorp());
|
|
|
|
|
|
|
|
orderEntity.setFromCorpId(basicUnitMaintainEntity.getErpId());
|
|
|
|
|
|
|
|
orderService.updateOrder(orderEntity);
|
|
|
|
|
|
|
|
basicUnitMaintainService.insertBasicUnitMaintain(basicUnitMaintainEntity);
|
|
|
|
|
|
|
|
}
|
|
|
|
BasicUnitMaintainEntity basicUnitMaintainEntity = basicUnitMaintainService.selectByName(orderEntity.getFromCorp());
|
|
|
|
BasicUnitMaintainEntity basicUnitMaintainEntity = basicUnitMaintainService.selectByName(orderEntity.getFromCorp());
|
|
|
|
if (basicUnitMaintainEntity == null) {
|
|
|
|
if (basicUnitMaintainEntity == null) {
|
|
|
|
orderEntity.setRemark("未选择往来单位");
|
|
|
|
orderEntity.setRemark("未选择往来单位");
|
|
|
@ -261,16 +317,6 @@ public class IoTransInoutService {
|
|
|
|
orderEntity.setFromCorpId(basicUnitMaintainEntity.getErpId());
|
|
|
|
orderEntity.setFromCorpId(basicUnitMaintainEntity.getErpId());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
BussinessTypeEntity bussinessTypeEntity = bussinessTypeService.findBTByAction(orderEntity.getAction());
|
|
|
|
|
|
|
|
if (bussinessTypeEntity.getCorpType() == ConstantStatus.CORP_TYPE_INPUT) {
|
|
|
|
|
|
|
|
BasicUnitMaintainEntity basicUnitMaintainEntity = new BasicUnitMaintainEntity();
|
|
|
|
|
|
|
|
basicUnitMaintainEntity.setErpId(CustomUtil.getUnitId());
|
|
|
|
|
|
|
|
basicUnitMaintainEntity.setCorpType(ConstantStatus.CORP_SICK);
|
|
|
|
|
|
|
|
basicUnitMaintainEntity.setName(orderEntity.getFromCorp());
|
|
|
|
|
|
|
|
orderEntity.setFromCorpId(basicUnitMaintainEntity.getErpId());
|
|
|
|
|
|
|
|
orderService.updateOrder(orderEntity);
|
|
|
|
|
|
|
|
basicUnitMaintainService.insertBasicUnitMaintain(basicUnitMaintainEntity);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// if (!Constant.SYSTEM_CUSTOMER_ID.equals(orderEntity.getFromCorpId())) {
|
|
|
|
// if (!Constant.SYSTEM_CUSTOMER_ID.equals(orderEntity.getFromCorpId())) {
|
|
|
@ -322,7 +368,7 @@ public class IoTransInoutService {
|
|
|
|
orderService.updateRemark(orderEntity.getId(), "udi码:" + warehouseEntity.getCode() + "该产品不允许以使用单元入库!");
|
|
|
|
orderService.updateRemark(orderEntity.getId(), "udi码:" + warehouseEntity.getCode() + "该产品不允许以使用单元入库!");
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (bussinessTypeEntity.getCorpType() == ConstantStatus.CORP_TYPE_OUT) {
|
|
|
|
if (bussinessTypeEntity.getCorpType() == ConstantStatus.CORP_TYPE_OUT && bussinessTypeEntity.getMainAction().equals(ConstantType.TYPE_PUT)) {
|
|
|
|
CompanyProductRelevanceEntity companyProductRelevanceEntity = companyProductRelevanceService.findByUdiRlIdUnitFk(udiRelevanceResponse.getId() + "", warehouseEntity.getFromCorpId());
|
|
|
|
CompanyProductRelevanceEntity companyProductRelevanceEntity = companyProductRelevanceService.findByUdiRlIdUnitFk(udiRelevanceResponse.getId() + "", warehouseEntity.getFromCorpId());
|
|
|
|
if (companyProductRelevanceEntity == null) {
|
|
|
|
if (companyProductRelevanceEntity == null) {
|
|
|
|
orderService.updateOrderStatus(warehouseEntity.getOrderId(), ConstantStatus.ORDER_STATUS_FAIL);
|
|
|
|
orderService.updateOrderStatus(warehouseEntity.getOrderId(), ConstantStatus.ORDER_STATUS_FAIL);
|
|
|
@ -371,8 +417,9 @@ public class IoTransInoutService {
|
|
|
|
warehouseEntity.setStatus(0);
|
|
|
|
warehouseEntity.setStatus(0);
|
|
|
|
if (warehouseEntity.getRelId() == null)
|
|
|
|
if (warehouseEntity.getRelId() == null)
|
|
|
|
warehouseEntity.setRelId(udiRelevanceEntities.get(0).getId() + "");
|
|
|
|
warehouseEntity.setRelId(udiRelevanceEntities.get(0).getId() + "");
|
|
|
|
if (bussinessTypeEntity.getCorpType() == ConstantStatus.CORP_TYPE_OUT) {
|
|
|
|
|
|
|
|
String originSupId = checkOriginExitSup(warehouseEntity);
|
|
|
|
String originSupId = checkOriginExitSup(warehouseEntity);
|
|
|
|
|
|
|
|
if (originSupId == null) {
|
|
|
|
|
|
|
|
if (bussinessTypeEntity.getCorpType() == ConstantStatus.CORP_TYPE_OUT) {
|
|
|
|
String supId = null;
|
|
|
|
String supId = null;
|
|
|
|
if (originSupId == null) {
|
|
|
|
if (originSupId == null) {
|
|
|
|
supId = checkExitSup(warehouseEntity.getRelId());
|
|
|
|
supId = checkExitSup(warehouseEntity.getRelId());
|
|
|
@ -391,6 +438,8 @@ public class IoTransInoutService {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
warehouseEntity.setSupId(supId);
|
|
|
|
warehouseEntity.setSupId(supId);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
warehouseService.updateCode(warehouseEntity);
|
|
|
|
warehouseService.updateCode(warehouseEntity);
|
|
|
@ -489,7 +538,18 @@ public class IoTransInoutService {
|
|
|
|
CompanyEntity companyEntity = companyService.findCompany(companyProductRelevanceEntity.getCustomerId());
|
|
|
|
CompanyEntity companyEntity = companyService.findCompany(companyProductRelevanceEntity.getCustomerId());
|
|
|
|
return companyEntity.getUnitIdFk();
|
|
|
|
return companyEntity.getUnitIdFk();
|
|
|
|
} else if (companyProductRelevanceEntities != null && companyProductRelevanceEntities.size() > 1) {
|
|
|
|
} else if (companyProductRelevanceEntities != null && companyProductRelevanceEntities.size() > 1) {
|
|
|
|
|
|
|
|
String unitFk = companyProductRelevanceEntities.get(0).getUnitFk();
|
|
|
|
|
|
|
|
boolean isMuti = false;
|
|
|
|
|
|
|
|
for (CompanyProductRelevanceEntity companyProductRelevanceEntity : companyProductRelevanceEntities) {
|
|
|
|
|
|
|
|
if (!unitFk.equals(companyProductRelevanceEntity.getUnitFk())) {
|
|
|
|
|
|
|
|
isMuti = true;
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (isMuti)
|
|
|
|
return "MUTI"; //绑定多个供应商
|
|
|
|
return "MUTI"; //绑定多个供应商
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
return unitFk;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|