change - 采购申请单导入、排产逻辑修改

master
yinq 4 months ago
parent 720682f03c
commit 470b8bb782

@ -3,6 +3,7 @@ package com.hw.jindie.api;
import com.hw.common.core.constant.SecurityConstants;
import com.hw.common.core.constant.ServiceNameConstants;
import com.hw.common.core.domain.R;
import com.hw.common.core.web.domain.AjaxResult;
import com.hw.jindie.api.domain.vo.ErpSyncInfoVo;
import com.hw.jindie.api.factory.RemoteJindieFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
@ -39,4 +40,8 @@ public interface RemoteJindieService {
@PostMapping("/jindie/syncPurchaseOrderFromErp")
R<Integer> syncPurchaseOrderFromErp(@RequestBody ErpSyncInfoVo erpSyncInfoVo,@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
/** 采购申请单excel导入*/
@PostMapping("/jindie/singleSavePurchaseRequisition")
R<AjaxResult> singleSavePurchaseRequisition(@RequestBody String params, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
}

@ -1,6 +1,7 @@
package com.hw.jindie.api.factory;
import com.hw.common.core.domain.R;
import com.hw.common.core.web.domain.AjaxResult;
import com.hw.jindie.api.RemoteJindieService;
import com.hw.jindie.api.domain.vo.ErpSyncInfoVo;
import org.springframework.cloud.openfeign.FallbackFactory;
@ -39,6 +40,11 @@ public class RemoteJindieFallbackFactory implements FallbackFactory<RemoteJindie
public R<Integer> syncPurchaseOrderFromErp(ErpSyncInfoVo erpSyncInfoVo,String source) {
return R.fail("同步采购订单信息失败:" + throwable.getMessage());
}
@Override
public R<AjaxResult> singleSavePurchaseRequisition(String params, String source) {
return R.fail("采购申请单excel导入失败:" + throwable.getMessage());
}
};
}
}

@ -118,6 +118,8 @@ public class KingdeeErpSyncController {
* @return {"msg": "{"IsSuccess": true,"Errors": [],"SuccessEntitys": [{"Id": "154898","Number": "CGSQ010785","DIndex": 0}]}", "code": 200}
*/
@PostMapping(("/singleSavePurchaseRequisition"))
@Log(title = "ERP采购申请单", businessType = BusinessType.INSERT)
@InnerAuth
public AjaxResult singleSavePurchaseRequisition(@RequestBody String params) {
try {
return AjaxResult.success(kingdeeErpService.singleSavePurchaseRequisition(params));

@ -45,8 +45,9 @@ public class KingdeeErpService {
JSONObject FEntity = new JSONObject();
String FMaterialId = (String) objectParams.get("FMaterialId");//物料编码
String FUnitId = (String) objectParams.get("FUnitId");//单位
// String FMaterialDesc = (String) objectParams.get("FMaterialDesc");//物料说明
String FMaterialDesc = (String) objectParams.get("FMaterialDesc");//物料说明
Double FReqQty = (Double) objectParams.get("FReqQty");//采购数量
Double FTAXPRICE = (Double) objectParams.get("FTAXPRICE");//含税单价
try {
//业务对象标识
String formId = KingdeeConfig.PUR_Requisition;
@ -63,11 +64,11 @@ public class KingdeeErpService {
FEntity.put("FREQSTOCKUNITID", FUnitIdObject); //库存单位(必填项)
FEntity.put("FReqQty", FReqQty); //申请数量
// FEntity.put("FMaterialDesc", FMaterialDesc); //物料说明
FEntity.put("FMaterialDesc", FMaterialDesc); //物料说明
// FEntity.put("FReceiveOrgId", KingdeeConfig.getFApplicationOrgId()); //收料组织
// FEntity.put("FApproveQty", FReqQty); //批准数量
// FEntity.put("FEvaluatePrice", 0.0); //单价
// FEntity.put("FTAXPRICE", 0.0); //含税单价
FEntity.put("FTAXPRICE", FTAXPRICE); //含税单价
// FEntity.put("FTAXRATE", 0.0); //税率%
// FEntity.put("FPriceUnitQty", FReqQty); //计价数量
// FEntity.put("FREQSTOCKQTY", FReqQty); //库存单位数量

@ -84,6 +84,12 @@
<version>3.6.3</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.hw</groupId>
<artifactId>hw-api-jindie</artifactId>
<version>3.6.3</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>

@ -0,0 +1,49 @@
package com.hw.mes.controller;
import com.hw.common.core.utils.poi.ExcelUtil;
import com.hw.common.core.web.controller.BaseController;
import com.hw.common.core.web.domain.AjaxResult;
import com.hw.common.log.annotation.Log;
import com.hw.common.log.enums.BusinessType;
import com.hw.common.security.utils.SecurityUtils;
import com.hw.mes.domain.MesPurchaseRequisitionTemplate;
import com.hw.mes.service.IMesBasePalletInfoService;
import com.hw.mes.service.IMesImportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
/**
* MES excelController
*
* @author Yinq
* @date 2024-07-18
*/
@RestController
@RequestMapping("/import")
public class MesImportController extends BaseController {
@Autowired
private IMesImportService mesImportService;
/**
* excel
*/
@Log(title = "采购申请单", businessType = BusinessType.IMPORT)
@PostMapping(("/purchaseRequisitionImportData"))
public AjaxResult purchaseRequisitionImportData(MultipartFile file, boolean updateSupport) throws Exception
{
ExcelUtil<MesPurchaseRequisitionTemplate> util = new ExcelUtil<>(MesPurchaseRequisitionTemplate.class);
List<MesPurchaseRequisitionTemplate> purchaseRequisitionTemplateList = util.importExcel(file.getInputStream());
String operName = SecurityUtils.getUsername();
String message = mesImportService.importPurchaseRequisition(purchaseRequisitionTemplateList, operName);
return success(message);
}
}

@ -3,6 +3,7 @@ package com.hw.mes.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.hw.common.core.utils.StringUtils;
import com.hw.common.security.utils.SecurityUtils;
import com.hw.mes.domain.MesSaleOrder;
import com.hw.mes.service.IMesSaleOrderService;
@ -109,17 +110,13 @@ public class MesProductOrderController extends BaseController {
}
/**
*
*
* @param productOrderList
* @return
*/
@PostMapping("/batchEditingProductOrder")
public AjaxResult batchEditingProductOrder(@RequestBody List<MesProductOrder> productOrderList) {
int result = 0;
for (MesProductOrder productOrder : productOrderList) {
productOrder.setUpdateBy(SecurityUtils.getLoginUser().getUsername());
result = mesProductOrderService.updateMesProductOrder(productOrder);
}
int result = mesProductOrderService.batchEditingProductOrder(productOrderList);
return toAjax(result);
}

@ -2,6 +2,7 @@ package com.hw.mes.domain;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
@ -209,6 +210,43 @@ public class MesProductOrder extends BaseEntity {
@Excel(name = "前置生产工单编号")
private String preOrderCode;
/** MesProductPlan主键标识 */
private Long planId;
/**
* MesProductPlan
*/
private String planCode;
/**
* -
*/
private List<String> planDateRange;
public List<String> getPlanDateRange() {
return planDateRange;
}
public void setPlanDateRange(List<String> planDateRange) {
this.planDateRange = planDateRange;
}
public Long getPlanId() {
return planId;
}
public void setPlanId(Long planId) {
this.planId = planId;
}
public String getPlanCode() {
return planCode;
}
public void setPlanCode(String planCode) {
this.planCode = planCode;
}
public String getPreOrderCode() {
return preOrderCode;
}

@ -0,0 +1,145 @@
package com.hw.mes.domain;
import com.hw.common.core.annotation.Excel;
import com.hw.common.core.web.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.math.BigDecimal;
import java.util.List;
/**
*
*
* @author Yinq
* @date 2024-01-25
*/
public class MesPurchaseRequisitionTemplate {
private static final long serialVersionUID = 1L;
/**
*
*/
@Excel(name = "序号")
private Long serialNumber;
/**
*
*/
@Excel(name = "名称")
private String materialName;
/**
*
*/
@Excel(name = "产品规格型号")
private String productModel;
/**
*
*/
@Excel(name = "单位")
private String unit;
/**
*
*/
@Excel(name = "数量")
private BigDecimal amount;
/**
*
*/
@Excel(name = "生产厂家")
private String manufacturer;
/**
*
*/
@Excel(name = "含税单(元)")
private BigDecimal taxUnitPrice;
/**
*
*/
@Excel(name = "含税总价(元)")
private BigDecimal taxTotalPrice;
public Long getSerialNumber() {
return serialNumber;
}
public void setSerialNumber(Long serialNumber) {
this.serialNumber = serialNumber;
}
public String getMaterialName() {
return materialName;
}
public void setMaterialName(String materialName) {
this.materialName = materialName;
}
public String getProductModel() {
return productModel;
}
public void setProductModel(String productModel) {
this.productModel = productModel;
}
public String getUnit() {
return unit;
}
public void setUnit(String unit) {
this.unit = unit;
}
public BigDecimal getAmount() {
return amount;
}
public void setAmount(BigDecimal amount) {
this.amount = amount;
}
public String getManufacturer() {
return manufacturer;
}
public void setManufacturer(String manufacturer) {
this.manufacturer = manufacturer;
}
public BigDecimal getTaxUnitPrice() {
return taxUnitPrice;
}
public void setTaxUnitPrice(BigDecimal taxUnitPrice) {
this.taxUnitPrice = taxUnitPrice;
}
public BigDecimal getTaxTotalPrice() {
return taxTotalPrice;
}
public void setTaxTotalPrice(BigDecimal taxTotalPrice) {
this.taxTotalPrice = taxTotalPrice;
}
@Override
public String toString() {
return "MesPurchaseRequisitionTemplate{" +
"serialNumber=" + serialNumber +
", materialName='" + materialName + '\'' +
", productModel='" + productModel + '\'' +
", unit='" + unit + '\'' +
", amount=" + amount +
", manufacturer='" + manufacturer + '\'' +
", taxUnitPrice=" + taxUnitPrice +
", taxTotalPrice=" + taxTotalPrice +
'}';
}
}

@ -0,0 +1,24 @@
package com.hw.mes.service;
import com.hw.mes.domain.MesPurchaseRequisitionTemplate;
import java.util.List;
/**
* excelService
*
* @author Yinq
* @date 2024-01-26
*/
public interface IMesImportService
{
/**
*
* @param purchaseRequisitionTemplateList
* @param operName
* @return
*/
String importPurchaseRequisition(List<MesPurchaseRequisitionTemplate> purchaseRequisitionTemplateList, String operName);
}

@ -95,4 +95,12 @@ public interface IMesProductOrderService
* @return
*/
public List<MesProductOrder> selectAllListTaskList(MesProductOrder mesProductOrder);
/**
*
* @param productOrderList
* @return
*/
public int batchEditingProductOrder(List<MesProductOrder> productOrderList);
}

@ -0,0 +1,117 @@
package com.hw.mes.service.impl;
import com.alibaba.fastjson2.JSONObject;
import com.hw.common.core.constant.SecurityConstants;
import com.hw.common.core.domain.R;
import com.hw.common.core.exception.ServiceException;
import com.hw.common.core.utils.StringUtils;
import com.hw.common.core.utils.bean.BeanValidators;
import com.hw.common.core.web.domain.AjaxResult;
import com.hw.common.security.utils.SecurityUtils;
import com.hw.jindie.api.RemoteJindieService;
import com.hw.mes.api.RemoteMesService;
import com.hw.mes.api.domain.MesBaseMaterialInfo;
import com.hw.mes.domain.MesPurchaseRequisitionTemplate;
import com.hw.mes.service.IMesBaseMaterialInfoService;
import com.hw.mes.service.IMesImportService;
import com.hw.system.api.domain.SysUser;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* excelService
*
* @author Yinq
* @date 2024-01-25
*/
@Service
public class MesImportImpl implements IMesImportService {
@Autowired
private IMesBaseMaterialInfoService materialInfoService;
@Autowired
private RemoteJindieService remoteJindieService;
private static final Logger log = LoggerFactory.getLogger(MesImportImpl.class);
/**
*
*
* @param purchaseRequisitionTemplateList
* @param operName
* @return
*/
@Override
public String importPurchaseRequisition(List<MesPurchaseRequisitionTemplate> purchaseRequisitionTemplateList, String operName) {
if (StringUtils.isNull(purchaseRequisitionTemplateList) || purchaseRequisitionTemplateList.size() == 0) {
throw new ServiceException("导入采购申请单数据不能为空!");
}
int successNum = 0;
int failureNum = 0;
StringBuilder successMsg = new StringBuilder();
StringBuilder failureMsg = new StringBuilder();
for (MesPurchaseRequisitionTemplate purchaseRequisitionTemplate : purchaseRequisitionTemplateList) {
try {
String materialName = purchaseRequisitionTemplate.getMaterialName();
String productModel = purchaseRequisitionTemplate.getProductModel();
//产品规格型号把excel中的除.的符号都去掉(包括空格换行)
productModel = productModel.replaceAll("[^\\w.]", "");
MesBaseMaterialInfo materialInfo = new MesBaseMaterialInfo();
materialInfo.setMaterialName(materialName);
List<MesBaseMaterialInfo> materialInfoList = materialInfoService.selectMesBaseMaterialInfoList(materialInfo);
int successFlag = 0;
MesBaseMaterialInfo findMaterialInfo = new MesBaseMaterialInfo();
for (MesBaseMaterialInfo baseMaterialInfo : materialInfoList) {
String materialSpec = baseMaterialInfo.getMaterialSpec();
materialSpec = materialSpec.replaceAll("[^\\w.]", "");
if (materialSpec.equals(productModel)) {
successFlag++;
findMaterialInfo = baseMaterialInfo;
}
}
if (successFlag == 1) {
//导入ERP
JSONObject data = new JSONObject();
data.put("FMaterialId", findMaterialInfo.getMaterialCode());
data.put("FMaterialDesc", findMaterialInfo.getMaterialSpec());
data.put("FUnitId", purchaseRequisitionTemplate.getUnit());
data.put("FReqQty", purchaseRequisitionTemplate.getAmount());
data.put("FTAXPRICE", purchaseRequisitionTemplate.getTaxUnitPrice());
String params = data.toJSONString();
R<AjaxResult> ajaxResult = remoteJindieService.singleSavePurchaseRequisition(params, SecurityConstants.INNER);
successNum++;
successMsg.append("<br/>").append(materialName).append(" 导入成功");
log.info(purchaseRequisitionTemplate.toString(), ajaxResult);
} else if (successFlag > 1) {
failureNum++;
failureMsg.append("<br/>").append(failureNum).append(" 查出多条物料记录 导入失败");
} else {
failureNum++;
failureMsg.append("<br/>").append(failureNum).append(" 未找到物料记录 导入失败");
}
} catch (Exception e) {
failureNum++;
String msg = "<br/>" + failureNum + " 导入失败:";
failureMsg.append(msg + e.getMessage());
log.error(msg, e);
}
}
if (failureNum > 0) {
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
throw new ServiceException(failureMsg.toString());
} else {
successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
}
return successMsg.toString();
}
}

@ -11,14 +11,20 @@ import com.hw.common.core.exception.ServiceException;
import com.hw.common.core.utils.DateUtils;
import com.hw.common.core.utils.StringUtils;
import com.hw.common.core.utils.uuid.Seq;
import com.hw.common.security.utils.SecurityUtils;
import com.hw.mes.domain.MesMaterialBom;
import com.hw.mes.domain.MesProductPlan;
import com.hw.mes.mapper.MesProductPlanMapper;
import com.hw.mes.service.IMesMaterialBomService;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hw.mes.mapper.MesProductOrderMapper;
import com.hw.mes.domain.MesProductOrder;
import com.hw.mes.service.IMesProductOrderService;
import static com.hw.common.core.utils.DateUtils.YYYY_MM_DD_HH_MM_SS;
/**
* Service
*
@ -33,6 +39,9 @@ public class MesProductOrderServiceImpl implements IMesProductOrderService {
@Autowired
private IMesMaterialBomService mesMaterialBomService;
@Autowired
private MesProductPlanMapper mesProductPlanMapper;
/**
*
*
@ -241,10 +250,76 @@ public class MesProductOrderServiceImpl implements IMesProductOrderService {
if (topLevelOrder != null) {
traverseChildren(result, topLevelOrder, visited);
}
//查找生产派工
List<MesProductOrder> productOrderList = new ArrayList<>();
for (MesProductOrder order : result) {
Long orderId = order.getProductOrderId();
List<String> planDateRange = new ArrayList<>();
if (StringUtils.isNotNull(order.getPlanBeginTime())){
planDateRange.add(DateFormatUtils.format(order.getPlanBeginTime(), YYYY_MM_DD_HH_MM_SS));
}
if (StringUtils.isNotNull(order.getPlanEndTime())){
planDateRange.add(DateFormatUtils.format(order.getPlanEndTime(), YYYY_MM_DD_HH_MM_SS));
}
order.setPlanDateRange(planDateRange);
MesProductPlan productPlan = new MesProductPlan();
productPlan.setProductOrderId(orderId);
List<MesProductPlan> productPlanList = mesProductPlanMapper.selectMesProductPlanList(productPlan);
for (MesProductPlan mesProductPlan : productPlanList) {
MesProductOrder productOrder = new MesProductOrder();
List<String> dateRange = new ArrayList<>();
if (StringUtils.isNotNull(mesProductPlan.getPlanBeginTime())){
dateRange.add(DateFormatUtils.format(mesProductPlan.getPlanBeginTime(), YYYY_MM_DD_HH_MM_SS));
}
if (StringUtils.isNotNull(mesProductPlan.getPlanEndTime())){
dateRange.add(DateFormatUtils.format(mesProductPlan.getPlanEndTime(), YYYY_MM_DD_HH_MM_SS));
}
productOrder.setPlanDateRange(dateRange);
productOrder.setProductOrderId(mesProductPlan.getPlanId());
productOrder.setPlanCode(mesProductPlan.getPlanCode());
productOrder.setPreOrderId(order.getProductOrderId());
productOrder.setPlanBeginTime(mesProductPlan.getPlanBeginTime());
productOrder.setPlanEndTime(mesProductPlan.getPlanEndTime());
productOrder.setPlanAmount(mesProductPlan.getPlanAmount());
productOrder.setPlanId(mesProductPlan.getPlanId());
productOrderList.add(productOrder);
}
order.setPreOrderId(0L);
}
result.addAll(productOrderList);
// 返回包含所有关联订单的结果列表
return result;
}
/**
*
* @param productOrderList
* @return
*/
@Override
public int batchEditingProductOrder(List<MesProductOrder> productOrderList) {
int result = 0;
for (MesProductOrder productOrder : productOrderList) {
productOrder.setUpdateBy(SecurityUtils.getLoginUser().getUsername());
if (StringUtils.isNull(productOrder.getPlanId())){
result = mesProductOrderMapper.updateMesProductOrder(productOrder);
} else {
MesProductPlan productPlan = new MesProductPlan();
productPlan.setPlanId(productOrder.getPlanId());
productPlan.setPlanBeginTime(productOrder.getPlanBeginTime());
productPlan.setPlanEndTime(productOrder.getPlanEndTime());
if (StringUtils.isNotNull(productPlan.getPlanBeginTime()) || StringUtils.isNotNull(productPlan.getPlanEndTime())){
result = mesProductPlanMapper.updateMesProductPlan(productPlan);
}
}
}
return result;
}
// 递归查找最顶级节点
private MesProductOrder findTopLevelOrder(Long productOrderId) {
MesProductOrder currentOrder = mesProductOrderMapper.selectMesProductOrderByProductOrderId(productOrderId);
@ -266,6 +341,7 @@ public class MesProductOrderServiceImpl implements IMesProductOrderService {
// 获取所有以当前订单为父级ID的子订单列表
List<MesProductOrder> children = mesProductOrderMapper.selectMesProductOrderListByPreOrderId(currentOrder.getProductOrderId());
for (MesProductOrder child : children) {
child.setPreOrderCode(currentOrder.getOrderCode());
// 递归遍历每个子订单
traverseChildren(result, child, visited);
}

@ -57,7 +57,6 @@
bmi.material_spec,
bmi.net_weight,
bmi.gross_weight,
bmi.bind_flag,
bmi.factory_id,
bmi.create_org_id,
bmi.use_org_id,

@ -124,6 +124,7 @@
<if test="productOrderId != null ">and mpp.product_order_id = #{productOrderId}</if>
<if test="planCode != null and planCode != ''">and mpp.plan_code = #{planCode}</if>
<if test="dispatchCode != null and dispatchCode != ''">and mpp.dispatch_code = #{dispatchCode}</if>
<if test="orderCode != null and orderCode != ''">and po.order_code = #{orderCode}</if>
<if test="materialId != null ">and mpp.material_id = #{materialId}</if>
<if test="materialBomId != null ">and mpp.material_bom_id = #{materialBomId}</if>
<if test="processId != null ">and mpp.process_id = #{processId}</if>

@ -76,6 +76,8 @@
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
>
<el-table-column label="工单编号" prop="orderCode" v-if="columns[1].visible" width="250"/>
<el-table-column label="计划编号" prop="planCode" v-if="columns[31].visible" width="180"/>
<el-table-column label="前置生产工单编号" align="center" prop="preOrderCode" v-if="columns[32].visible" width="180"/>
<el-table-column label="销售订单ID" align="center" prop="saleOrderId" v-if="columns[2].visible" width="100"/>
<el-table-column label="销售订单标识" align="center" prop="saleOrderFlag" v-if="columns[3].visible" width="100"/>
<el-table-column label="销售订单编号" align="center" prop="saleorderCode" v-if="columns[4].visible" width="120"/>
@ -109,6 +111,13 @@
</template>
</el-table-column>
<el-table-column label="工期(天)" align="center" prop="duration" width="90" v-if="columns[30].visible"/>
<el-table-column label="计划开始结束时间" align="center" prop="planBeginTime" width="420" v-if="columns[33].visible">
<template slot-scope="scope">
<el-date-picker v-model="scope.row.planDateRange" style="width:400px;"
type="datetimerange" value-format="yyyy-MM-dd HH:mm:ss" clearable
/>
</template>
</el-table-column>
<el-table-column label="计划开始时间" align="center" prop="planBeginTime" width="230" v-if="columns[18].visible">
<template slot-scope="scope">
<el-date-picker v-model="scope.row.planBeginTime" style="width:200px;"
@ -362,22 +371,22 @@ export default {
{key: 1, label: `工单编号`, visible: true},
{key: 2, label: `销售订单ID`, visible: false},
{key: 3, label: `销售订单标识`, visible: false},
{key: 4, label: `销售订单编号`, visible: true},
{key: 4, label: `销售订单编号`, visible: false},
{key: 5, label: `销售订单行号`, visible: false},
{key: 6, label: `项目编号`, visible: false},
{key: 7, label: `销售类型`, visible: true},
{key: 7, label: `销售类型`, visible: false},
{key: 8, label: `物料ID`, visible: false},
{key: 9, label: `物料bomID`, visible: false},
{key: 10, label: `派工类型`, visible: false},
{key: 11, label: `派工ID`, visible: false},
{key: 12, label: `销售数量`, visible: true},
{key: 12, label: `销售数量`, visible: false},
{key: 13, label: `计划交货日期`, visible: false},
{key: 14, label: `计划数量`, visible: true},
{key: 15, label: `已派工数量`, visible: true},
{key: 16, label: `完成数量`, visible: true},
{key: 15, label: `已派工数量`, visible: false},
{key: 16, label: `完成数量`, visible: false},
{key: 17, label: `发布时间`, visible: false},
{key: 18, label: `计划开始时间`, visible: true},
{key: 19, label: `计划结束时间`, visible: true},
{key: 18, label: `计划开始时间`, visible: false},
{key: 19, label: `计划结束时间`, visible: false},
{key: 20, label: `开始时间`, visible: false},
{key: 21, label: `完成时间`, visible: false},
{key: 22, label: `工单状态`, visible: false},
@ -389,6 +398,9 @@ export default {
{key: 28, label: `更新时间`, visible: false},
{key: 29, label: `前置生产工单ID`, visible: false},
{key: 30, label: `工期(天)`, visible: true},
{key: 31, label: `计划编号`, visible: true},
{key: 32, label: `前置生产工单编号`, visible: true},
{key: 33, label: `计划开始结束时间`, visible: true},
],
};
},
@ -474,6 +486,7 @@ export default {
realEndTime: null,
orderStatus: null,
stockLockFlag: null,
planDateRange: null,
remark: null,
createBy: null,
createTime: null,
@ -513,25 +526,37 @@ export default {
});
},
extractFields(data) {
let result = [];
data.forEach(item => {
const {productOrderId, planBeginTime, planEndTime, children} = item;
result.push({productOrderId, planBeginTime, planEndTime});
let result = []; //
for (let i = 0; i < data.length; i++) {
let item = data[i];
const { productOrderId, planDateRange, planId, children } = item;
result.push({ productOrderId, planBeginTime: planDateRange[0], planEndTime: planDateRange[1], planId });
let planBeginTime = planDateRange[0]
let planEndTime = planDateRange[1]
// planEndTime
if (this.arrangeType === 1 && planEndTime != null && i < data.length - 1) {
let date = new Date(planEndTime); // planEndTime
date.setDate(date.getDate() + 1); //
if (data.length > i){
let nextTime = parseTime(date);
data[i + 1].planDateRange[0] = nextTime; // planBeginTime
// console.log(planDateRange[0], planDateRange[1],data[i + 1].productOrderId)
// console.log(i,data[i + 1].planDateRange[0], this.productOrderList[i + 1].planDateRange[0])
// if (data[i + 1].planDateRange[1] < data[i + 1].planDateRange[0]){
// data[i + 1].planDateRange[1] = data[i + 1].planDateRange[0]
// }
}
}
// planBeginTime planEndTime
if (planBeginTime != null && planEndTime != null) {
item.duration = this.calculateDaysDifference(planBeginTime, planEndTime);
}
if (this.arrangeType === 1 && planEndTime != null && children != null) {
const date = new Date(planEndTime);
date.setDate(date.getDate() + 1);
children.forEach(item => {
item.planBeginTime = parseTime(date);
})
}
if (children) {
result = result.concat(this.extractFields(children));
}
});
return result;
}
return result; //
},
//
calculateDaysDifference(date1, date2) {

Loading…
Cancel
Save