|
|
@ -11,10 +11,7 @@ import com.digiwin.athena.app.ptc.infra.service.ProductionDetailsService; |
|
|
|
import com.digiwin.athena.app.ptc.infra.service.ReceivablesDetailService; |
|
|
|
import com.digiwin.athena.opt.common.eai.EAIRequest; |
|
|
|
import com.digiwin.athena.opt.common.eai.service.AbsEAIService; |
|
|
|
import com.digiwin.athena.opt.common.generator.SnowflakeWorker; |
|
|
|
import com.digiwin.athena.opt.common.util.RedisUtil; |
|
|
|
import org.apache.commons.lang.time.DateUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
@ -34,8 +31,6 @@ public class ProductionCreateEAIService extends AbsEAIService { |
|
|
|
@Resource |
|
|
|
private ReceivablesDetailService receivablesDetailService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private RedisUtil redisUtil; |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@ -68,8 +63,9 @@ public class ProductionCreateEAIService extends AbsEAIService { |
|
|
|
|
|
|
|
Random random = new Random(); |
|
|
|
//默认赋值 |
|
|
|
Integer batchNo = 1; |
|
|
|
for (ProductionDetailsEntity productionDetailsEntity : productionDetailsEntities) { |
|
|
|
int randomNumber = random.nextInt(2)+1; |
|
|
|
int randomNumber = random.nextInt(3); |
|
|
|
productionDetailsEntity.setFactoryNo(this.list.get(randomNumber).getFactoryNo()); |
|
|
|
productionDetailsEntity.setFactoryName(this.list.get(randomNumber).getFactoryName()); |
|
|
|
productionDetailsEntity.setProductionManagementPerson(this.list.get(randomNumber).getProductionManagementPerson()); |
|
|
@ -77,10 +73,11 @@ public class ProductionCreateEAIService extends AbsEAIService { |
|
|
|
productionDetailsEntity.setProduceBoss("23467345221"); |
|
|
|
productionDetailsEntity.setProductionStatus(TabStatusEnums.PENDING.getValue().toString()); |
|
|
|
productionDetailsEntity.setNature(String.valueOf(randomNumber)); |
|
|
|
String batchNo = SnowflakeWorker.nextId().toString(); |
|
|
|
productionDetailsEntity.setBatchNo("MMDD-"+batchNo); |
|
|
|
productionDetailsEntity.setBatchNo("MMDD-000"+batchNo); |
|
|
|
productionDetailsEntity.setUnit("pcs"); |
|
|
|
batchNo = batchNo+1; |
|
|
|
//预计产量赋值 |
|
|
|
if (CollectionUtils.isNotEmpty(list)) { |
|
|
|
if (CollectionUtils.isNotEmpty(receivablesDetailEntities)) { |
|
|
|
for (ReceivablesDetailEntity receivablesDetailEntity : receivablesDetailEntities) { |
|
|
|
productionDetailsEntity.setExpectedQuantity(receivablesDetailEntity.getQuantity()); |
|
|
|
//取应收日期前后5天 |
|
|
@ -90,11 +87,10 @@ public class ProductionCreateEAIService extends AbsEAIService { |
|
|
|
productionDetailsEntity.setSkuCode(receivablesDetailEntity.getSkuCode()); |
|
|
|
productionDetailsEntity.setSkuName(receivablesDetailEntity.getSkuName()); |
|
|
|
productionDetailsEntity.setSkuSpec(receivablesDetailEntity.getSkuSpec()); |
|
|
|
productionDetailsEntity.setUnit("待定"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
productionDetailsService.saveBatch(productionDetailsEntities); |
|
|
|
return buildOK(); |
|
|
|
} |
|
|
|
|
|
|
|