|
@@ -13,9 +13,11 @@ import com.fjhx.mes.entity.production.po.ProductionOrder;
|
|
|
import com.fjhx.mes.entity.production.po.ProductionOrderDetail;
|
|
|
import com.fjhx.mes.entity.production.vo.ProductionOrderDetailVo;
|
|
|
import com.fjhx.mes.entity.production.vo.ProductionOrderVo;
|
|
|
+import com.fjhx.mes.entity.work.po.WorkOrder;
|
|
|
import com.fjhx.mes.mapper.production.ProduceOrderMapper;
|
|
|
import com.fjhx.mes.service.production.ProduceOrderDetailService;
|
|
|
import com.fjhx.mes.service.production.ProduceOrderService;
|
|
|
+import com.fjhx.mes.service.work.WorkOrderService;
|
|
|
import com.fjhx.sale.entity.contract.po.Contract;
|
|
|
import com.fjhx.sale.entity.contract.po.ContractProduct;
|
|
|
import com.fjhx.sale.service.contract.ContractProductService;
|
|
@@ -54,6 +56,8 @@ public class ProduceOrderServiceImpl extends ServiceImpl<ProduceOrderMapper, Pro
|
|
|
private ISysDeptService sysDeptService;
|
|
|
@Autowired
|
|
|
private ProductInfoService productInfoService;
|
|
|
+ @Autowired
|
|
|
+ private WorkOrderService workOrderService;
|
|
|
|
|
|
@Override
|
|
|
public Page<ProductionOrderVo> getPage(ProduceOrderSelectDto dto) {
|
|
@@ -138,6 +142,23 @@ public class ProduceOrderServiceImpl extends ServiceImpl<ProduceOrderMapper, Pro
|
|
|
productionOrderDetailList.add(productionOrderDetail);
|
|
|
}
|
|
|
produceOrderDetailService.saveBatch(productionOrderDetailList);
|
|
|
+
|
|
|
+ //创建生产订单明细
|
|
|
+ List<WorkOrder> workOrderList = new ArrayList<>();
|
|
|
+ for (ContractProduct contractProduct : contractProductList) {
|
|
|
+ //生成工单
|
|
|
+ for (int i = 1; i <= contractProduct.getQuantity().intValue(); i++) {
|
|
|
+ WorkOrder workOrder = new WorkOrder();
|
|
|
+ workOrder.setCode(contract.getCode());
|
|
|
+ workOrder.setProductId(contractProduct.getProductId());
|
|
|
+ workOrder.setQuantity(BigDecimal.ONE);
|
|
|
+ workOrder.setStatus(0);
|
|
|
+ workOrder.setContractId(contractId);
|
|
|
+ workOrder.setContractDetailsId(contractProduct.getId());
|
|
|
+ workOrderList.add(workOrder);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ workOrderService.saveBatch(workOrderList);
|
|
|
}
|
|
|
|
|
|
}
|