生产派工:4楼对内生产和5楼外部销售派工逻辑完善;
车间生产:5楼拆分工位完善(开始逻辑判断工单状态并更新工单状态,打印背板和门板条码唯一,完成时判断条码绑定信息,申请领柜体一个明细只能领取一个,返库前判断是否已经绑定);5楼装配工位完善(判断工单状态,校验背板或门板码是否是同一派工,生产明细显示规格型号,申请领料完成调用调度通知完成领料);
master
xs 7 months ago
parent 3b17b2879e
commit 68a276854c

@ -124,6 +124,10 @@ public class MesBaseBarcodeInfo extends BaseEntity
@Excel(name = "项目号")
private String projectNo;
/**
* 使使mes_product_plan_detailplan_detail_code*/
private String transferredPlanDetailCode;
/** 流水号 */
@Excel(name = "流水号")
private String serialNumber;
@ -401,6 +405,15 @@ public class MesBaseBarcodeInfo extends BaseEntity
{
return projectNo;
}
public String getTransferredPlanDetailCode() {
return transferredPlanDetailCode;
}
public void setTransferredPlanDetailCode(String transferredPlanDetailCode) {
this.transferredPlanDetailCode = transferredPlanDetailCode;
}
public void setSerialNumber(String serialNumber)
{
this.serialNumber = serialNumber;

@ -137,6 +137,9 @@ public class MesConstants {
public static final String MES_BARCODE_PRINT_FLAG_NO = "0";//否
/**工序类型*/
public static final String MES_PROCESS_TYPE_FIFTH_SPLIT = "1";//五楼拆分工序
}

@ -240,4 +240,9 @@ public class WmsConstants {
//车间生产区域类型
public static final String MES_AREA_TYPE_FOUTHFLOOR_ASSEMBLE = "3";//四楼装配区域
public static final String MES_AREA_TYPE_FOUTHFLOOR_PARTS = "4";//四楼零配件仓库
//原材料出库拆分标识
public static final String WMS_RAW_OUTSTOCK_SPLIT_FLAG_YES = "1";
}

@ -149,27 +149,57 @@ public class MesProductPlanController extends BaseController
return toAjax(mesProductPlanService.orderAddMesProductPlanList(productPlanEditVo));
}
/**
* List
/* *//**
* List()
* @param planId
* @return
*/
*//*
@GetMapping(value = "/drawingList/{planId}")
public AjaxResult getDispatchDrawingList(@PathVariable("planId") Long planId)
{
return success(mesProductPlanService.getDispatchAttachList(planId, MesConstants.MES_ATTACH_TYPE_DRAWING));
}
/**
* SOPList
*//**
* SOPList
* @param planId
* @return
*/
*//*
@GetMapping(value = "/SOPAttachList/{planId}")
public AjaxResult getDispatchSOPAttachList(@PathVariable("planId") Long planId)
{
return success(mesProductPlanService.getDispatchAttachList(planId, MesConstants.MES_ATTACH_TYPE_SOP));
}
*/
/**
* List
* @param dispatchCode
* @param processId
* @return
*/
@GetMapping(value = "/drawingList/{dispatchCode}/{processId}")
public AjaxResult getDispatchDrawingList(@PathVariable("dispatchCode") String dispatchCode,
@PathVariable("processId") Long processId)
{
return success(mesProductPlanService.getDispatchAttachList(dispatchCode,processId, MesConstants.MES_ATTACH_TYPE_DRAWING));
}
/**
* SOPList
* @param dispatchCode
* @param processId
* @return
*/
@GetMapping(value = "/SOPAttachList/{dispatchCode}/{processId}")
public AjaxResult getDispatchSOPAttachList(@PathVariable("dispatchCode") String dispatchCode,
@PathVariable("processId") Long processId)
{
return success(mesProductPlanService.getDispatchAttachList(dispatchCode,processId,MesConstants.MES_ATTACH_TYPE_SOP));
}
/**
*

@ -167,6 +167,11 @@ public class MesProductPlan extends BaseEntity
*/
private String materialName;
/**
*
*/
private String materialSpec;
/** 生产计划明细信息 */
@ -495,6 +500,14 @@ public class MesProductPlan extends BaseEntity
this.materialName = materialName;
}
public String getMaterialSpec() {
return materialSpec;
}
public void setMaterialSpec(String materialSpec) {
this.materialSpec = materialSpec;
}
public String getProcessType() {
return processType;
}

@ -66,6 +66,8 @@ public class MesProductPlanDetail extends BaseEntity
private String materialBarcode;
private String processType;//工序类型1五楼拆分工序
public void setPlanDetailId(Long planDetailId)
{
this.planDetailId = planDetailId;
@ -190,6 +192,14 @@ public class MesProductPlanDetail extends BaseEntity
this.materialBarcode = materialBarcode;
}
public String getProcessType() {
return processType;
}
public void setProcessType(String processType) {
this.processType = processType;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

@ -126,4 +126,13 @@ public interface MesProductPlanMapper
*/
public int deleteMesProductPlanByDispatchCode(String dispatchCode);
/**
*
*
* @param mesProductPlan
* @return
*/
public List<MesProductPlan> selectOnlyMesProductPlans(MesProductPlan mesProductPlan);
}

@ -112,6 +112,16 @@ public interface IMesProductPlanService
*/
public List<MesBaseAttachInfo> getDispatchAttachList(Long planId, String attachType);
/**
* List
*
* @param dispatchCode
* @param processId
* @param attachType
* @return
*/
public List<MesBaseAttachInfo> getDispatchAttachList(String dispatchCode,Long processId, String attachType);
/**
*
*

@ -8,12 +8,15 @@ import com.hw.common.core.constant.SecurityConstants;
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.poi.ExcelUtil;
import com.hw.common.security.utils.SecurityUtils;
import com.hw.mes.api.domain.MesBaseBarcodeInfo;
import com.hw.mes.domain.vo.MesPalletInfoBindVo;
import com.hw.mes.mapper.MesBaseBarcodeInfoMapper;
import com.hw.printer.api.RemotePrinterService;
import com.hw.printer.api.domain.vo.PrintContentVo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hw.mes.mapper.MesBasePalletInfoMapper;
@ -31,6 +34,9 @@ import javax.annotation.Resource;
*/
@Service
public class MesBasePalletInfoServiceImpl implements IMesBasePalletInfoService {
private static final Logger log = LoggerFactory.getLogger(MesBasePalletInfoServiceImpl.class);
@Autowired
private MesBasePalletInfoMapper mesBasePalletInfoMapper;
@ -119,16 +125,18 @@ public class MesBasePalletInfoServiceImpl implements IMesBasePalletInfoService {
@Override
@Transactional(rollbackFor = Exception.class)
public int bindPalletInfo(MesPalletInfoBindVo mesPalletInfoBindVo) {
String palletInfoCode = mesPalletInfoBindVo.getPalletInfoCode();
String materialBarcode = mesPalletInfoBindVo.getMaterialBarcode();
String palletInfoCode = mesPalletInfoBindVo.getPalletInfoCode().trim();
String materialBarcode = mesPalletInfoBindVo.getMaterialBarcode().trim();
MesBaseBarcodeInfo mesBaseBarcodeInfo = mesBaseBarcodeInfoMapper.selectMesBaseBarcodeInfoByBarcodeInfo(materialBarcode);
if (mesBaseBarcodeInfo == null) {
log.error("palletInfoCode:"+palletInfoCode+",materialBarcode:"+materialBarcode);
throw new ServiceException("物料条码有误");
}
MesBasePalletInfo mesBasePalletInfo = mesBasePalletInfoMapper.selectMesBasePalletInfoByPalletInfoCode(palletInfoCode);
if (mesBasePalletInfo == null) {
log.error("palletInfoCode:"+palletInfoCode+",materialBarcode:"+materialBarcode);
throw new ServiceException("托盘码有误");
}

@ -101,14 +101,16 @@ public class MesBaseStationInfoServiceImpl implements IMesBaseStationInfoService
*/
@Override
public MesBaseStationInfo getLoginStationInfo() {
//TODO:正式时需要修改回来
String ipAddress = SecurityUtils.getLoginUser().getIpaddr();
ipAddress = "192.168.2.20";//TODO:正式时需要删除
// ipAddress = "192.168.2.25";
MesBaseStationInfo mesBaseStationInfo = mesBaseStationInfoMapper.selectMesBaseStationInfoByStationIp(ipAddress);
Integer processFloor = SecurityUtils.getProcessFloor();
if (mesBaseStationInfo != null && mesBaseStationInfo.getFloor() != null && !mesBaseStationInfo.getFloor().equals(processFloor)) {
throw new ServiceException("请在" + processFloor + "楼登录此工序");
}
// MesBaseStationInfo mesBaseStationInfo = mesBaseStationInfoMapper.selectMesBaseStationInfoByStationId(526l);
return mesBaseStationInfo;
}
}

@ -79,6 +79,9 @@ public class MesProductOrderServiceImpl implements IMesProductOrderService {
}else{
mesProductOrder.setSaleAmount(mesProductOrder.getPlanAmount());
}
if (mesProductOrder.getSaleOrderId() == null) {
mesProductOrder.setSaleOrderId(0L);
}
return mesProductOrderMapper.insertMesProductOrder(mesProductOrder);
}

@ -7,6 +7,7 @@ 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.api.domain.MesBaseBarcodeInfo;
import com.hw.mes.config.MesConfig;
import com.hw.mes.domain.*;
import com.hw.mes.domain.vo.MesProductPlanDetailVo;
import com.hw.mes.mapper.*;
@ -191,7 +192,7 @@ public class MesProductPlanDetailServiceImpl implements IMesProductPlanDetailSer
String userName = SecurityUtils.getUsername();
Long userId = SecurityUtils.getUserId();
startProductOrder(dbProductPlan,currentDate,userName);
startProductOrder(dbProductPlan, currentDate, userName);
if (planStatus.equals(MesConstants.MES_PRODUCT_PLAN_STATUS_DISPATCHED)) {
dbProductPlan.setRealBeginTime(currentDate);
@ -224,21 +225,33 @@ public class MesProductPlanDetailServiceImpl implements IMesProductPlanDetailSer
selectMesProductPlanDetailByPlanDetailId(planDetailId);
String planDetailStatus = dbProductPlanDetail.getPlanDetailStatus();
if (planDetailStatus.equals(MesConstants.MES_PRODUCT_PLAN_DETAIL_STATUS_TO_START)) {
throw new ServiceException("此生产计划明细未开始");
throw new ServiceException("此生产明细未开始");
} else if (planDetailStatus.equals(MesConstants.MES_PRODUCT_PLAN_DETAIL_STATUS_FINISH)) {
throw new ServiceException("此生产计划明细已结束");
throw new ServiceException("此生产明细已结束");
}
Long planId = dbProductPlanDetail.getPlanId();
MesProductPlan dbProductPlan = mesProductPlanMapper.selectMesProductPlanByPlanId(planId);
String planStatus = dbProductPlan.getPlanStatus();
if (planStatus.equals(MesConstants.MES_PRODUCT_PLAN_STATUS_TO_DISPATCH)) {
throw new ServiceException("此生产计划未派工,不能结束");
throw new ServiceException("此生产明细未派工,不能结束");
} else if (planStatus.equals(MesConstants.MES_PRODUCT_PLAN_STATUS_FINISH)) {
throw new ServiceException("此生产计划已结束");
throw new ServiceException("此生产派工已结束");
}
//如果是五楼拆分,校验是否有绑定条码
if (mesProductPlanDetail.getProcessType().equals(MesConstants.MES_PROCESS_TYPE_FIFTH_SPLIT)) {
MesBaseBarcodeInfo queryBaseBarcodeInfo = new MesBaseBarcodeInfo();
queryBaseBarcodeInfo.setPlanDetailCode(dbProductPlanDetail.getPlanDetailCode());
List<MesBaseBarcodeInfo> mesBaseBarcodeInfos = mesBaseBarcodeInfoMapper.selectMesBaseBarcodeInfoList(queryBaseBarcodeInfo);
List<MesBaseBarcodeInfo> bindBaseBarcodeInfos = mesBaseBarcodeInfos.stream().filter(mesBaseBarcodeInfo ->
StringUtils.isNotEmpty(mesBaseBarcodeInfo.getBindBarcode())).collect(Collectors.toList());
if (bindBaseBarcodeInfos == null || bindBaseBarcodeInfos.isEmpty()) {
throw new ServiceException("请绑定条码执行返库后再执行完成");
}
}
//校验生产计划明细校验信息(如果是多个工序只校验最后一个工序,一楼和四楼都是一个工序,暂时不校验最后一个工序),
//校验生产计划明细物料使用情况校验信息(如果是多个工序只校验最后一个工序,一楼是一个工序,暂时不校验最后一个工序)
List<MesMaterialCheckResult> checkResults =
mesMaterialCheckResultMapper.selectMesMaterialCheckResult(planId, planDetailId, "0," + dbProductPlan.getMaterialBomId());
List<MesMaterialCheckResult> filterCheckResults = checkResults.stream().filter(
@ -270,9 +283,9 @@ public class MesProductPlanDetailServiceImpl implements IMesProductPlanDetailSer
dbProductPlan.setPlanStatus(MesConstants.MES_PRODUCT_PLAN_STATUS_FINISH);
dbProductPlan.setRealEndTime(currentDate);
//todo更新生产工单状态、结束时间和完成数量根据finalprocessFlag更新生产工单
//todo更新生产任务状态、结束时间和完成数量根据finalprocessFlag更新生产任务
}
dbProductPlan.setCompleteAmount(newComplementAmount);
dbProductPlan.setUpdateTime(currentDate);
dbProductPlan.setUpdateBy(userName);
@ -330,21 +343,59 @@ public class MesProductPlanDetailServiceImpl implements IMesProductPlanDetailSer
if (!planDetailStatus.equals(MesConstants.MES_PRODUCT_PLAN_DETAIL_STATUS_FINISH)
&& !planDetailStatus.equals(MesConstants.MES_PRODUCT_PLAN_DETAIL_STATUS_ABNORMAL_FINISH)) {
//如果不是完成状态则不能开始下一任务明细
throw new ServiceException("请先完成上一任务明细");
throw new ServiceException("请先完成上一生产明细");
} else {
Date realEndTime = newestPlanDetail.getRealEndTime();
//todo:在完成任务后需要过多久才能继续下一任务
//在完成任务后需要过多久才能继续下一任务,先不考虑
}
}
MesProductPlan mesProductPlan = mesProductPlanMapper.selectMesProductPlanByPlanId(mesProductPlanDetail.getPlanId());
//判断生产计划的状态
String planStatus = mesProductPlan.getPlanStatus();
if (planStatus.equals(MesConstants.MES_PRODUCT_PLAN_STATUS_TO_DISPATCH)) {
throw new ServiceException("还未派工,不能开始");
} else if (planStatus.equals(MesConstants.MES_PRODUCT_PLAN_STATUS_FINISH)) {
throw new ServiceException("此生产派工已经结束");
}
Date currentDate = new Date();
String userName = SecurityUtils.getUsername();
Long userId = SecurityUtils.getUserId();
String planDetailCode = Seq.getId(Seq.mesProductPlanDetailSeqType, Seq.mesProductPlanDetailCode);
//五楼装配工位要扫码开始
if (startType.equals(MesConstants.MES_START_TYPE_FIFTH_FLOOR_ASSEMBLE)) {
String materialBarcode = mesProductPlanDetail.getMaterialBarcode();
MesBaseBarcodeInfo mesBaseBarcodeInfo = mesBaseBarcodeInfoMapper.selectMesBaseBarcodeInfoByBarcodeInfo(materialBarcode);
if (mesBaseBarcodeInfo == null) {
throw new ServiceException("物料条码有误");
throw new ServiceException("条码有误");
}
if (!mesBaseBarcodeInfo.getBarcodeType().equals(MesConstants.MES_BARCODE_TYPE_BACKPLATE) &&
!mesBaseBarcodeInfo.getBarcodeType().equals(MesConstants.MES_BARCODE_TYPE_DOOR)) {
throw new ServiceException("请扫描背板或门板条码开始");
}
if (StringUtils.isEmpty(mesBaseBarcodeInfo.getBindBarcode())) {
throw new ServiceException("此条码有误,未绑定任何柜体");
}
if(StringUtils.isNotEmpty(mesBaseBarcodeInfo.getTransferredPlanDetailCode())){
throw new ServiceException("此条码已经扫描使用过,不能再次使用");
}
//校验此条码是否是同一派工单
MesProductPlan barcodeProductPlan = mesProductPlanMapper.selectOnlyMesProductPlanByPlanCode(mesBaseBarcodeInfo.getPlanCode());
if (barcodeProductPlan == null) {
throw new ServiceException("条码有误,没有相关派工");
}
if (!barcodeProductPlan.getDispatchCode().equals(mesProductPlan.getDispatchCode())) {
throw new ServiceException("此条码的派工单号为:" + barcodeProductPlan.getDispatchCode() + ",与此派工单号不符");
}
// MesMaterialAssignInfo queryMaterialAssignInfo = new MesMaterialAssignInfo();
// queryMaterialAssignInfo.setMaterialBarcode(materialBarcode);
// List<MesMaterialAssignInfo> mesMaterialAssignInfoList = mesMaterialAssignInfoMapper.selectMesMaterialAssignInfoList(queryMaterialAssignInfo);
@ -352,23 +403,17 @@ public class MesProductPlanDetailServiceImpl implements IMesProductPlanDetailSer
// throw new ServiceException("此物料条码还没下发到工位");
// }
}
mesBaseBarcodeInfo.setTransferredPlanDetailCode(planDetailCode);
mesBaseBarcodeInfo.setUpdateTime(currentDate);
mesBaseBarcodeInfo.setUpdateBy(userName);
mesBaseBarcodeInfoMapper.updateMesBaseBarcodeInfo(mesBaseBarcodeInfo);
MesProductPlan mesProductPlan = mesProductPlanMapper.selectMesProductPlanByPlanId(mesProductPlanDetail.getPlanId());
//判断生产计划的状态
String planStatus = mesProductPlan.getPlanStatus();
if (planStatus.equals(MesConstants.MES_PRODUCT_PLAN_STATUS_TO_DISPATCH)) {
throw new ServiceException("还未派工,不能开始");
} else if (planStatus.equals(MesConstants.MES_PRODUCT_PLAN_STATUS_FINISH)) {
throw new ServiceException("此生产派工已经结束");
}
Date currentDate = new Date();
String userName = SecurityUtils.getUsername();
Long userId = SecurityUtils.getUserId();
startProductOrder(mesProductPlan,currentDate,userName);
//判断生产任务状态,并根据状态更新生产任务
startProductOrder(mesProductPlan, currentDate, userName);
if (planStatus.equals(MesConstants.MES_PRODUCT_PLAN_STATUS_DISPATCHED)) {//如果状态是已开始,需要修改计划的状态和开始时间
mesProductPlan.setPlanStatus(MesConstants.MES_PRODUCT_PLAN_STATUS_STARTED);
@ -379,7 +424,7 @@ public class MesProductPlanDetailServiceImpl implements IMesProductPlanDetailSer
}
mesProductPlanDetail.setPlanDetailStatus(MesConstants.MES_PRODUCT_PLAN_DETAIL_STATUS_STARTED);
mesProductPlanDetail.setPlanDetailCode(Seq.getId(Seq.mesProductPlanDetailSeqType, Seq.mesProductPlanDetailCode));
mesProductPlanDetail.setPlanDetailCode(planDetailCode);
mesProductPlanDetail.setPlanCode(mesProductPlan.getPlanCode());
mesProductPlanDetail.setPlanDetailStatus(MesConstants.MES_PRODUCT_PLAN_DETAIL_STATUS_STARTED);
mesProductPlanDetail.setIsFlag("1");
@ -391,25 +436,26 @@ public class MesProductPlanDetailServiceImpl implements IMesProductPlanDetailSer
mesProductPlanDetailMapper.insertMesProductPlanDetail(mesProductPlanDetail);
return mesProductPlanDetail;
}
public void startProductOrder(MesProductPlan productPlan,Date currentDate,String userName){
public void startProductOrder(MesProductPlan productPlan, Date currentDate, String userName) {
MesProductOrder productOrder = mesProductOrderMapper.selectMesProductOrderByProductOrderId(productPlan.getProductOrderId());
if(productOrder==null){
throw new ServiceException("无此生产工单");
if (productOrder == null) {
throw new ServiceException("无此生产任务");
}
String orderStatus = productOrder.getOrderStatus();
if(!orderStatus.equals(MesConstants.BEGIN) && !orderStatus.equals(MesConstants.PUBLISHED)){
if (!orderStatus.equals(MesConstants.BEGIN) && !orderStatus.equals(MesConstants.PUBLISHED)) {
String orderStatusPrompt = MesConstants.ORDER_STATUS_PROMPT_MAP.get(orderStatus);
throw new ServiceException(String.format("此生产工单已经%s,不能开始!", orderStatusPrompt));
throw new ServiceException(String.format("此生产任务已经%s,不能开始!", orderStatusPrompt));
}
if(orderStatus.equals(MesConstants.PUBLISHED)){
if (orderStatus.equals(MesConstants.PUBLISHED)) {
productOrder.setOrderStatus(MesConstants.BEGIN);
productOrder.setRealBeginTime(currentDate);
productOrder.setUpdateBy(userName);

@ -307,6 +307,54 @@ public class MesProductPlanServiceImpl implements IMesProductPlanService {
}
}
/**
* List
*
* @param dispatchCode
* @param processId
* @param attachType
* @return
*/
@Override
public List<MesBaseAttachInfo> getDispatchAttachList(String dispatchCode, Long processId, String attachType) {
MesProductPlan queryProductPlan = new MesProductPlan();
queryProductPlan.setProcessId(processId);
queryProductPlan.setDispatchCode(dispatchCode);
List<MesProductPlan> mesProductPlans = mesProductPlanMapper.selectOnlyMesProductPlans(queryProductPlan);
if (mesProductPlans != null && !mesProductPlans.isEmpty()) {
MesProductPlan mesProductPlan = mesProductPlans.get(0);
try {
if (attachType.equals(MesConstants.MES_ATTACH_TYPE_DRAWING)) {
if (StringUtils.isEmpty(mesProductPlan.getAttachId())) {
return new ArrayList<>();
}
Long[] attachIds = Arrays.stream(mesProductPlan.getAttachId().split(","))
.map(String::trim)
.map(Long::parseLong)
.toArray(Long[]::new);
return mesBaseAttachInfoService.selectMesBaseAttachInfoByAttachIds(attachIds);
} else if (attachType.equals(MesConstants.MES_ATTACH_TYPE_SOP)) {
if (StringUtils.isEmpty(mesProductPlan.getSopId())) {
return new ArrayList<>();
}
Long[] sopIds = Arrays.stream(mesProductPlan.getSopId().split(","))
.map(String::trim)
.map(Long::parseLong)
.toArray(Long[]::new);
return mesBaseAttachInfoService.selectMesBaseAttachInfoByAttachIds(sopIds);
} else {
return new ArrayList<>();
}
} catch (Exception e) {
return new ArrayList<>();
}
}
return new ArrayList<>();
}
/**
*
*
@ -341,7 +389,7 @@ public class MesProductPlanServiceImpl implements IMesProductPlanService {
public List<MesProductPlan> selectMesProductPlanJoinList(MesProductPlan mesProductPlan) {
Long processId = SecurityUtils.getProcessId();
Long userId = SecurityUtils.getUserId();
if(!SecurityUtils.isAdmin(userId)) {
if (!SecurityUtils.isAdmin(userId)) {
mesProductPlan.setUserId(userId);
}
mesProductPlan.setProcessId(processId);

@ -32,6 +32,7 @@
<result property="saleOrderId" column="sale_order_id"/>
<result property="saleorderCode" column="saleorder_code"/>
<result property="projectNo" column="project_no"/>
<result property="transferredPlanDetailCode" column="transferred_plan_detail_code"/>
<result property="serialNumber" column="serial_number"/>
<result property="remark" column="remark"/>
<result property="bindStatus" column="bind_status"/>
@ -42,7 +43,7 @@
<result property="materialCode" column="material_code"/>
<result property="materialName" column="material_name"/>
<result property="materialSpec" column="material_spec"/>
<result property="bindFlag" column="bind_flag"/>
<result property="alwaysFlag" column="always_flag"/>
<result property="checkStatus" column="checkStatus"/>
</resultMap>
@ -74,6 +75,7 @@
bbi.sale_order_id,
bbi.saleorder_code,
bbi.project_no,
bbi.transferred_plan_detail_code,
bbi.print_flag,
bbi.serial_number,
bbi.remark,
@ -141,6 +143,7 @@
<if test="barcodeInfo != null and barcodeInfo != ''">barcode_info,</if>
<if test="batchCode != null and batchCode != ''">batch_code,</if>
<if test="palletInfoCode != null">pallet_info_code,</if>
<if test="bindBarcode != null">bind_barcode,</if>
<if test="materialId != null">material_id,</if>
<if test="manufacturerId != null">manufacturer_id,</if>
<if test="amount != null">amount,</if>
@ -175,6 +178,7 @@
<if test="barcodeInfo != null and barcodeInfo != ''">#{barcodeInfo},</if>
<if test="batchCode != null and batchCode != ''">#{batchCode},</if>
<if test="palletInfoCode != null">#{palletInfoCode},</if>
<if test="bindBarcode != null">#{bindBarcode},</if>
<if test="materialId != null">#{materialId},</if>
<if test="manufacturerId != null">#{manufacturerId},</if>
<if test="amount != null">#{amount},</if>
@ -227,6 +231,7 @@
<if test="saleOrderId != null">sale_order_id = #{saleOrderId},</if>
<if test="saleorderCode != null">saleorder_code = #{saleorderCode},</if>
<if test="projectNo != null">project_no = #{projectNo},</if>
<if test="transferredPlanDetailCode != null">transferred_plan_detail_code = #{transferredPlanDetailCode},</if>
<if test="serialNumber != null">serial_number = #{serialNumber},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="bindBarcode != null">bind_barcode = #{bindBarcode},</if>
@ -342,7 +347,7 @@
bmi.material_code,
bmi.material_name,
bmi.material_spec,
bmi.bind_flag,
bmi.always_flag,
qcr.check_status
from mes_base_barcode_info bbi
left join mes_base_material_info bmi on bmi.material_id = bbi.material_id

@ -22,7 +22,7 @@
<result property="materialSpec" column="material_spec"/>
<result property="netWeight" column="net_weight"/>
<result property="grossWeight" column="gross_weight"/>
<result property="bindFlag" column="bind_flag" />
<result property="alwaysFlag" column="always_flag" />
<result property="factoryId" column="factory_id"/>
<result property="createOrgId" column="create_org_id"/>
<result property="useOrgId" column="use_org_id"/>
@ -58,6 +58,7 @@
bmi.material_spec,
bmi.net_weight,
bmi.gross_weight,
bmi.always_flag,
bmi.factory_id,
bmi.create_org_id,
bmi.purchase_price_unit_id,
@ -200,7 +201,7 @@
<if test="materialSpec != null">material_spec = #{materialSpec},</if>
<if test="netWeight != null">net_weight = #{netWeight},</if>
<if test="grossWeight != null">gross_weight = #{grossWeight},</if>
<if test="bindFlag != null and bindFlag != ''">bind_flag = #{bindFlag},</if>
<if test="alwaysFlag != null and alwaysFlag != ''">always_flag = #{alwaysFlag},</if>
<if test="factoryId != null">factory_id = #{factoryId},</if>
<if test="createOrgId != null">create_org_id = #{createOrgId},</if>
<if test="useOrgId != null">use_org_id = #{useOrgId},</if>
@ -214,7 +215,7 @@
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="approveDate != null">approve_date = #{approveDate},</if>
<if test="erpModifyDate != null">erp_modify_date = #{erpModifyDate},</if>
<if test="bindFlag != null">bind_flag = #{bindFlag},</if>
<if test="alwaysFlag != null">always_flag = #{alwaysFlag},</if>
<if test="batchAmount != null">batch_amount = #{batchAmount},</if>
</trim>
where material_id = #{materialId}
@ -322,7 +323,7 @@
bmi.material_spec,
bmi.net_weight,
bmi.gross_weight,
bmi.bind_flag,
bmi.always_flag,
bmi.factory_id,
bmi.create_org_id,
bmi.use_org_id,

@ -41,6 +41,7 @@
<result property="planDeliveryDate" column="plan_delivery_date"/>
<result property="materialCode" column="material_code"/>
<result property="materialName" column="material_name"/>
<result property="materialSpec" column="material_spec"/>
<result property="processName" column="process_name"/>
<result property="processType" column="process_type"/>
<result property="stationName" column="station_name"/>
@ -198,7 +199,7 @@
insert into mes_product_plan
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="productOrderId != null">product_order_id,</if>
<if test="saleOrderId != null and saleOrderId != ''">sale_order_id,</if>
<if test="saleOrderId != null">sale_order_id,</if>
<if test="saleorderCode != null and saleorderCode != ''">saleorder_code,</if>
<if test="planCode != null and planCode != ''">plan_code,</if>
<if test="dispatchCode != null and dispatchCode != ''">dispatch_code,</if>
@ -337,7 +338,7 @@
mpp.material_bom_id, mpp.process_id, mpp.process_order, mpp.last_process_id,mpp.user_id,
mpp.station_id, mpp.dispatch_amount, mpp.plan_amount, mpp.complete_amount, mpp.plan_begin_time, mpp.plan_end_time,
mpp.real_begin_time, mpp.real_end_time,
mpp.attach_id, mpp.plan_status, mpo.plan_delivery_date,mbmi.material_code,mbmi.material_name
mpp.attach_id, mpp.plan_status, mpo.plan_delivery_date,mbmi.material_code,mbmi.material_name,mbmi.material_spec
from mes_product_plan mpp left join mes_product_order mpo on mpp.product_order_id = mpo.product_order_id
left join mes_base_material_info mbmi on mpp.material_id=mbmi.material_id
<where>
@ -457,4 +458,38 @@
where dispatch_code = #{dispatchCode}
</delete>
<select id="selectOnlyMesProductPlans" parameterType="MesProductPlan" resultMap="MesProductPlanResult">
select a.plan_id,
a.product_order_id,
a.plan_code,
a.dispatch_code,
a.material_id,
a.material_bom_id,
a.process_id,
a.process_order,
a.last_process_id,
a.station_id,
a.user_id,
a.production_time,
a.dispatch_amount,
a.plan_amount,
a.complete_amount,
a.plan_begin_time,
a.plan_end_time,
a.real_begin_time,
a.real_end_time,
a.attach_id,
a.sop_id,
a.plan_status,
a.is_flag
from mes_product_plan a
<where>
<if test="dispatchCode != null and dispatchCode != ''">and a.dispatch_code = #{dispatchCode}</if>
<if test="processId != null ">and a.process_id = #{processId}</if>
</where>
</select>
</mapper>

@ -18,6 +18,11 @@ public class WmsConfig {
*/
private String fifthAssembleStationCode;
/**
*
*/
private String fifthSplitStationCode;
/**
* ID
*/
@ -57,6 +62,14 @@ public class WmsConfig {
this.fifthAssembleStationCode = fifthAssembleStationCode;
}
public String getFifthSplitStationCode() {
return fifthSplitStationCode;
}
public void setFifthSplitStationCode(String fifthSplitStationCode) {
this.fifthSplitStationCode = fifthSplitStationCode;
}
public Long getFifthSemiWarehouseId() {
return fifthSemiWarehouseId;
}

@ -225,7 +225,7 @@ public class WmsMobileController extends BaseController {
/**
* 5
* 5
*/
@Log(title = "成品入库记录", businessType = BusinessType.INSERT)
@PostMapping(("/addProductInstock"))

@ -45,6 +45,8 @@ public class WmsProductStock extends BaseEntity
@Excel(name = "入库批次号")
private String productBatch;
private String palletInfoCode;
/** 质检状态(1检验中,2质检通过,3质检不通过) */
@Excel(name = "质检状态(1检验中,2质检通过,3质检不通过)")
private String qualityStatus;
@ -166,6 +168,15 @@ public class WmsProductStock extends BaseEntity
{
return productBatch;
}
public String getPalletInfoCode() {
return palletInfoCode;
}
public void setPalletInfoCode(String palletInfoCode) {
this.palletInfoCode = palletInfoCode;
}
public void setQualityStatus(String qualityStatus)
{
this.qualityStatus = qualityStatus;

@ -55,6 +55,8 @@ public class WmsRawOutstock extends BaseEntity {
@Excel(name = "销售订单ID")
private Long orderId;
private Long saleOrderId;
/**
* ,pd_base_plan_infoplan_id
*/
@ -115,6 +117,9 @@ public class WmsRawOutstock extends BaseEntity {
@Excel(name = "任务类型(1生产领料,2移库出库,3合库出库,9其他领料)")
private String taskType;
private String splitFlag;
/**
*
*/
@ -209,7 +214,6 @@ public class WmsRawOutstock extends BaseEntity {
private String materialBarcode;
private Long saleOrderId;
/**
*
@ -368,6 +372,14 @@ public class WmsRawOutstock extends BaseEntity {
return taskType;
}
public String getSplitFlag() {
return splitFlag;
}
public void setSplitFlag(String splitFlag) {
this.splitFlag = splitFlag;
}
public void setApplyReason(String applyReason) {
this.applyReason = applyReason;
}

@ -70,6 +70,14 @@ public class WmsProductOutstockServiceImpl implements IWmsProductOutstockService
/**
*
*|||||
* |:---- |:---|:----- |----- |
* | warehouseId | long ID; |
* | saleorderId | string
* | saleorderCode | string
* | productId | long
* | applyQty | bigDecimal |
* | applyReason | string |
*
* @param wmsProductOutstock
* @return

@ -290,7 +290,6 @@ public class WmsRawInstockServiceImpl implements IWmsRawInstockService {
}
}
WmsRawInstock wmsRawInstock = new WmsRawInstock();
wmsRawInstock.setTaskCode(Seq.getId(Seq.rawInstockSeqType, Seq.rawInstockSeqCode));
wmsRawInstock.setWarehouseId(wmsRawBackVo.getWarehouseId());

@ -500,7 +500,7 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
String planDetailCode = wmsRawOutstock.getPlanDetailCode();
if (StringUtils.isEmpty(planCode) || StringUtils.isEmpty(planDetailCode)) {
throw new ServiceException("请选择计划明细信息再领料");
throw new ServiceException("请选择派工明细信息再领料");
}
Long warehouseId = wmsRawOutstock.getWarehouseId();
@ -515,6 +515,7 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
: wmsRawOutstock.getTaskType();
String warehouseType = baseWarehouse.getWarehouseType();
//TODO 判断质检状态,还是在实际出库时判断质检状态
String queryQualityStatus = WmsConstants.WMS_QUALITY_STATUS_PASS;
@ -545,7 +546,7 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
WmsRawOutstock toInsertedRawOutstock = getWmsRawOutstock(baseWarehouse, wmsRawOutstock,
rawOutstockDetail.getMaterialId(), taskCode, taskType,
planAmount, currentDate, userName, wmsStockTotal.getStockTotalId());
planAmount, currentDate, userName, wmsStockTotal.getStockTotalId(), wmsStockTotal.getSaleOrderId());
toInsertedRawOutstocks.add(toInsertedRawOutstock);
} else {
@ -577,7 +578,7 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
*/
private WmsRawOutstock getWmsRawOutstock(WmsBaseWarehouse baseWarehouse, WmsRawOutstock wmsRawOutstockParam,
Long materialId, String taskCode, String taskType,
BigDecimal planAmount, Date currentDate, String userName, Long stockTotalId) {
BigDecimal planAmount, Date currentDate, String userName, Long stockTotalId, Long saleOrderId) {
//出库要求 0申请出库1申请审核出库2直接出库
String outRequirement = baseWarehouse.getOutRequirement();
String warehouseType = baseWarehouse.getWarehouseType();
@ -586,6 +587,21 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
WmsRawOutstock toInsertedRawOutstock = new WmsRawOutstock();
toInsertedRawOutstock.setExecuteStatus(WmsConstants.WMS_EXECUTE_STATUS_TOEXECUTE);
//如果是五楼拆分区,一个明细只能领取一个柜体
if (wmsRawOutstockParam.getTaskType().equals(WmsConstants.WMS_RAW_OUTSTOCK_TASK_TYPE_PRODUCTION_SPLIT)) {
WmsRawOutstock queryRawOutstock = new WmsRawOutstock();
queryRawOutstock.setPlanDetailCode(wmsRawOutstockParam.getPlanDetailCode());
queryRawOutstock.setSplitFlag(WmsConstants.WMS_RAW_OUTSTOCK_SPLIT_FLAG_YES);
List<WmsRawOutstock> wmsRawOutstocks = wmsRawOutstockMapper.selectWmsRawOutstockList(queryRawOutstock);
if (wmsRawOutstocks != null && !wmsRawOutstocks.isEmpty()) {
throw new ServiceException("一个明细信息只能领取一个柜体");
}
toInsertedRawOutstock.setSplitFlag(WmsConstants.WMS_RAW_OUTSTOCK_SPLIT_FLAG_YES);
}
if (warehouseType.equals(WmsConstants.WMS_WAREHOUSE_TYPE_NORMAL)) {//如果是普通仓库,需要校验审核标识
if (outRequirement.equals(WmsConstants.WMS_WAREHOUSE_OUT_REQUIREMENT_APPLY_AUDIT)) {
toInsertedRawOutstock.setAuditStatus(WmsConstants.WMS_AUDIT_STATUS_TOAUDIT);
@ -602,12 +618,18 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
// toInsertedRawOutstock.setLocationCode(wmsRawStock.getLocationCode());
toInsertedRawOutstock.setStationId(wmsRawOutstockParam.getStationId());
toInsertedRawOutstock.setStockTotalId(stockTotalId);
toInsertedRawOutstock.setSaleOrderId(saleOrderId);
// toInsertedRawOutstock.setPalletInfoCode(wmsRawStock.getPalletInfoCode());
toInsertedRawOutstock.setOperationType(operationType);
toInsertedRawOutstock.setApplyBy(userName);
toInsertedRawOutstock.setApplyReason(wmsRawOutstockParam.getApplyReason());
toInsertedRawOutstock.setApplyDate(currentDate);
toInsertedRawOutstock.setEndStationCode(wmsRawOutstockParam.getEndStationCode());
if (wmsRawOutstockParam.getTaskType().equals(WmsConstants.WMS_RAW_OUTSTOCK_TASK_TYPE_PRODUCTION_PICKING)) {
toInsertedRawOutstock.setEndStationCode(wmsRawOutstockParam.getEndStationCode());
} else if (wmsRawOutstockParam.getTaskType().equals(WmsConstants.WMS_RAW_OUTSTOCK_TASK_TYPE_PRODUCTION_SPLIT)) {
toInsertedRawOutstock.setEndStationCode((wmsConfig.getFifthSplitStationCode()));
}
toInsertedRawOutstock.setMaterialId(materialId);
toInsertedRawOutstock.setOutstockAmount(planAmount);
toInsertedRawOutstock.setPlanCode(wmsRawOutstockParam.getPlanCode());
@ -949,6 +971,17 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
if (StringUtils.isEmpty(bindBarcode)) {
throw new ServiceException("此柜体还未绑定");
}
//通过绑定的条码找到物料信息和saleorderid
R<MesBaseBarcodeInfo> bindBarcodeInfoR = remoteMesService.getBarcode(bindBarcode, SecurityConstants.INNER);
if (bindBarcodeInfoR == null) {
throw new ServiceException("绑定的柜体条码有误");
}
MesBaseBarcodeInfo bindBarcodeInfo = bindBarcodeInfoR.getData();
if (bindBarcodeInfo == null) {
throw new ServiceException("绑定的柜体条码有误");
}
WmsRawOutstock queryRawOutstock = new WmsRawOutstock();
queryRawOutstock.setMaterialBatch(bindBarcode);
List<WmsRawOutstock> wmsRawOutstocks = wmsRawOutstockMapper.selectWmsRawOutstockList(queryRawOutstock);
@ -973,10 +1006,11 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
wmsRawOutstock.setOrderId(baseBarcodeInfo.getSaleOrderId());
wmsRawOutstock.setPlanCode(baseBarcodeInfo.getPlanCode());
wmsRawOutstock.setPlanDetailCode(baseBarcodeInfo.getPlanDetailCode());
wmsRawOutstock.setMaterialId(baseBarcodeInfo.getMaterialId());
wmsRawOutstock.setMaterialId(bindBarcodeInfo.getMaterialId());
wmsRawOutstock.setMaterialBatch(bindBarcode);
wmsRawOutstock.setPalletInfoCode(baseBarcodeInfo.getPalletInfoCode());//在绑定时需要在条码信息中记录托盘码
wmsRawOutstock.setPalletInfoCode(bindBarcodeInfo.getPalletInfoCode());//在绑定时需要在条码信息中记录托盘码
wmsRawOutstock.setOutstockAmount(BigDecimal.ONE);
wmsRawOutstock.setSaleOrderId(bindBarcodeInfo.getSaleOrderId());
wmsRawOutstock.setEndStationCode(wmsConfig.getFifthAssembleStationCode());//目标位置,五楼组装区域
wmsRawOutstock.setOperationType(WmsConstants.WMS_OPERATION_TYPE_AUTO);
@ -1213,6 +1247,7 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
@Override
public WmsRawOutstock getNewestOutstockCabinet(WmsRawOutstock wmsRawOutstock) {
wmsRawOutstock.setExecuteStatus(WmsConstants.WMS_EXECUTE_STATUS_FINISH);
wmsRawOutstock.setTaskType(WmsConstants.WMS_RAW_OUTSTOCK_TASK_TYPE_PRODUCTION_SPLIT);
return wmsRawOutstockMapper.selectNewestWmsRawOutstock(wmsRawOutstock);
}
}

@ -200,11 +200,11 @@ public class WmsTransferServiceImpl implements IWmsTransferService {
R<MesBaseBarcodeInfo> mesBaseBarcodeInfoR = remoteMesService.getBarcode(materialBarcode, SecurityConstants.INNER);
if (mesBaseBarcodeInfoR == null) {
throw new ServiceException("物料码错误");
throw new ServiceException("物料码错误");
}
MesBaseBarcodeInfo mesBaseBarcodeInfo = mesBaseBarcodeInfoR.getData();
if (mesBaseBarcodeInfo == null) {
throw new ServiceException("物料码错误");
throw new ServiceException("物料码错误");
}
@ -227,6 +227,9 @@ public class WmsTransferServiceImpl implements IWmsTransferService {
if (productStock == null) {
throw new ServiceException("无此成品库存");
}
if (!productStock.getLocationCode().equals(wmsTransferDetail.getLocationCode())) {
throw new ServiceException("出库库位编码错误");
}
WmsTransfer wmsTransfer = new WmsTransfer();
wmsTransfer.setTaskCode(Seq.getId(Seq.wmsTransferSeqType, Seq.wmsTransferSeqCode));
@ -280,11 +283,11 @@ public class WmsTransferServiceImpl implements IWmsTransferService {
R<MesBaseBarcodeInfo> mesBaseBarcodeInfoR = remoteMesService.getBarcode(materialBarcode, SecurityConstants.INNER);
if (mesBaseBarcodeInfoR == null) {
throw new ServiceException("物料码错误");
throw new ServiceException("物料码错误");
}
MesBaseBarcodeInfo mesBaseBarcodeInfo = mesBaseBarcodeInfoR.getData();
if (mesBaseBarcodeInfo == null) {
throw new ServiceException("物料码错误");
throw new ServiceException("物料码错误");
}
WmsBaseLocation targetLocation = wmsBaseLocationMapper.selectWmsBaseLocationByLocationCode(targetLocationCode);
@ -302,6 +305,13 @@ public class WmsTransferServiceImpl implements IWmsTransferService {
throw new ServiceException("没有此成品的转库出库记录,不能转库入库");
}
WmsProductStock queryProductStock = new WmsProductStock();
queryProductStock.setLocationCode(targetLocationCode);
List<WmsProductStock> productStocks = wmsProductStockMapper.selectOnlyWmsProductStockInList(queryProductStock);
if(productStocks!=null && !productStocks.isEmpty()){
throw new ServiceException("此库位已经有库存,不能入库");
}
Long targetWarehouseId = targetLocation.getWarehouseId();
WmsBaseWarehouse targetWarehouse = wmsBaseWarehouseMapper.selectWmsBaseWarehouseByWarehouseId(targetWarehouseId);
@ -337,6 +347,7 @@ public class WmsTransferServiceImpl implements IWmsTransferService {
productStock.setLocationCode(targetLocationCode);
productStock.setStockType(WmsConstants.PRODUCT_STOCK_STOCK_TYPE_PRODUCT);
productStock.setProductBatch(materialBarcode);
productStock.setPalletInfoCode(mesBaseBarcodeInfo.getPalletInfoCode());
// productStock.setQualityStatus();//todo: 获取质检状态
productStock.setWarehouseFloor(targetWarehouse.getWarehouseFloor());
productStock.setProductId(mesBaseBarcodeInfo.getMaterialId());

@ -11,6 +11,7 @@
<result property="locationCode" column="location_code"/>
<result property="stockType" column="stock_type"/>
<result property="productBatch" column="product_batch"/>
<result property="palletInfoCode" column="pallet_info_code"/>
<result property="qualityStatus" column="quality_status"/>
<result property="productId" column="product_id"/>
<result property="planCode" column="plan_code"/>
@ -41,6 +42,7 @@
wps.location_code,
wps.stock_type,
wps.product_batch,
wps.pallet_info_code,
wps.quality_status,
wps.product_id,
mbmi.material_code,
@ -101,6 +103,7 @@
<if test="locationCode != null and locationCode != ''">location_code,</if>
<if test="stockType != null and stockType != ''">stock_type,</if>
<if test="productBatch != null">product_batch,</if>
<if test="palletInfoCode != null">pallet_info_code,</if>
<if test="qualityStatus != null and qualityStatus != ''">quality_status,</if>
<if test="productId != null">product_id,</if>
<if test="planCode != null">plan_code,</if>
@ -122,6 +125,7 @@
<if test="locationCode != null and locationCode != ''">#{locationCode},</if>
<if test="stockType != null and stockType != ''">#{stockType},</if>
<if test="productBatch != null">#{productBatch},</if>
<if test="palletInfoCode != null">#{palletInfoCode},</if>
<if test="qualityStatus != null and qualityStatus != ''">#{qualityStatus},</if>
<if test="productId != null">#{productId},</if>
<if test="planCode != null">#{planCode},</if>
@ -146,6 +150,7 @@
<if test="locationCode != null and locationCode != ''">location_code = #{locationCode},</if>
<if test="stockType != null and stockType != ''">stock_type = #{stockType},</if>
<if test="productBatch != null">product_batch = #{productBatch},</if>
<if test="palletInfoCode != null">pallet_info_code = #{palletInfoCode},</if>
<if test="qualityStatus != null and qualityStatus != ''">quality_status = #{qualityStatus},</if>
<if test="productId != null">product_id = #{productId},</if>
<if test="planCode != null">plan_code = #{planCode},</if>
@ -308,7 +313,7 @@
<if test="updateDate != null ">and wps.update_date = #{updateDate}</if>
<if test="activeFlag != null and activeFlag != ''">and wps.active_flag = #{activeFlag}</if>
<if test="instockDate != null ">and wps.instock_date = #{instockDate}</if>
and wps.totalAmount>0
and wps.total_amount>0
</where>
</select>

@ -11,6 +11,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="locationCode" column="location_code" />
<result property="stockTotalId" column="stock_total_id" />
<result property="orderId" column="order_id" />
<result property="saleOrderId" column="sale_order_id" />
<result property="planCode" column="plan_code" />
<result property="planDetailCode" column="plan_detail_code" />
<result property="stationId" column="station_id" />
@ -22,6 +23,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="endStationCode" column="end_station_code" />
<result property="operationType" column="operation_type" />
<result property="taskType" column="task_type" />
<result property="splitFlag" column="split_flag" />
<result property="applyReason" column="apply_reason" />
<result property="auditReason" column="audit_reason" />
<result property="auditStatus" column="audit_status" />
@ -74,7 +76,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectWmsRawOutstockVo">
select raw_outstock_id, task_code, warehouse_id, location_code, stock_total_id,order_id, plan_code, plan_detail_code, station_id, material_id, material_batch, pallet_info_code, outstock_amount, real_outstock_amount, end_station_code, operation_type, task_type, apply_reason, audit_reason, audit_status, execute_status, apply_by, apply_date, audit_by, audit_date, update_by, update_date, begin_time, end_time, erp_status, erp_amount from wms_raw_outstock
select raw_outstock_id, task_code, warehouse_id, location_code, stock_total_id,order_id,sale_order_id, plan_code, plan_detail_code, station_id, material_id, material_batch, pallet_info_code, outstock_amount, real_outstock_amount, end_station_code, operation_type, task_type, apply_reason, audit_reason, audit_status, execute_status, apply_by, apply_date, audit_by, audit_date, update_by, update_date, begin_time, end_time, erp_status, erp_amount from wms_raw_outstock
</sql>
<select id="selectWmsRawOutstockList" parameterType="WmsRawOutstock" resultMap="WmsRawOutstockResult">
@ -91,6 +93,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="materialId != null "> and material_id = #{materialId}</if>
<if test="operationType != null and operationType != ''"> and operation_type = #{operationType}</if>
<if test="taskType != null and taskType != ''"> and task_type = #{taskType}</if>
<if test="splitFlag != null and splitFlag != ''"> and split_flag = #{splitFlag}</if>
<if test="applyReason != null and applyReason != ''"> and apply_reason = #{applyReason}</if>
<if test="auditReason != null and auditReason != ''"> and audit_reason = #{auditReason}</if>
<if test="auditStatus != null and auditStatus != ''"> and audit_status = #{auditStatus}</if>
@ -119,6 +122,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="locationCode != null">location_code,</if>
<if test="stockTotalId != null">stock_total_id,</if>
<if test="orderId != null">order_id,</if>
<if test="saleOrderId != null">sale_order_id,</if>
<if test="planCode != null">plan_code,</if>
<if test="planDetailCode != null">plan_detail_code,</if>
<if test="stationId != null">station_id,</if>
@ -130,6 +134,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="endStationCode != null">end_station_code,</if>
<if test="operationType != null and operationType != ''">operation_type,</if>
<if test="taskType != null and taskType != ''">task_type,</if>
<if test="splitFlag != null and splitFlag != ''">split_flag,</if>
<if test="applyReason != null">apply_reason,</if>
<if test="auditReason != null">audit_reason,</if>
<if test="auditStatus != null and auditStatus != ''">audit_status,</if>
@ -151,6 +156,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="locationCode != null">#{locationCode},</if>
<if test="stockTotalId != null">#{stockTotalId},</if>
<if test="orderId != null">#{orderId},</if>
<if test="saleOrderId != null">#{saleOrderId},</if>
<if test="planCode != null">#{planCode},</if>
<if test="planDetailCode != null">#{planDetailCode},</if>
<if test="stationId != null">#{stationId},</if>
@ -162,6 +168,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="endStationCode != null">#{endStationCode},</if>
<if test="operationType != null and operationType != ''">#{operationType},</if>
<if test="taskType != null and taskType != ''">#{taskType},</if>
<if test="splitFlag != null and splitFlag != ''">#{splitFlag},</if>
<if test="applyReason != null">#{applyReason},</if>
<if test="auditReason != null">#{auditReason},</if>
<if test="auditStatus != null and auditStatus != ''">#{auditStatus},</if>
@ -186,6 +193,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="warehouseId != null">warehouse_id = #{warehouseId},</if>
<if test="locationCode != null">location_code = #{locationCode},</if>
<if test="orderId != null">order_id = #{orderId},</if>
<if test="saleOrderId != null">sale_order_id = #{saleOrderId},</if>
<if test="planCode != null">plan_code = #{planCode},</if>
<if test="planDetailCode != null">plan_detail_code = #{planDetailCode},</if>
<if test="stationId != null">station_id = #{stationId},</if>
@ -197,6 +205,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="endStationCode != null">end_station_code = #{endStationCode},</if>
<if test="operationType != null and operationType != ''">operation_type = #{operationType},</if>
<if test="taskType != null and taskType != ''">task_type = #{taskType},</if>
<if test="splitFlag != null and splitFlag != ''">split_flag = #{splitFlag},</if>
<if test="applyReason != null">apply_reason = #{applyReason},</if>
<if test="auditReason != null">audit_reason = #{auditReason},</if>
<if test="auditStatus != null and auditStatus != ''">audit_status = #{auditStatus},</if>
@ -298,9 +307,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<insert id="batchWmsRawOutstock">
insert into wms_raw_outstock(raw_outstock_id, task_code,warehouse_id,location_code,stock_total_id,order_id,plan_code,plan_detail_code,station_id,material_id,material_batch,pallet_info_code,outstock_amount,end_station_code,operation_type,task_type,audit_status,execute_status,apply_by,apply_date,apply_reason) values
insert into wms_raw_outstock(raw_outstock_id, task_code,warehouse_id,location_code,stock_total_id,order_id,sale_order_id,plan_code,plan_detail_code,station_id,material_id,material_batch,pallet_info_code,outstock_amount,end_station_code,operation_type,task_type,split_flag,audit_status,execute_status,apply_by,apply_date,apply_reason) values
<foreach item="item" index="index" collection="list" separator=",">
( #{item.rawOutstockId}, #{item.taskCode}, #{item.warehouseId}, #{item.locationCode}, #{item.stockTotalId}, #{item.orderId}, #{item.planCode}, #{item.planDetailCode}, #{item.stationId}, #{item.materialId}, #{item.materialBatch}, #{item.palletInfoCode}, #{item.outstockAmount}, #{item.endStationCode}, #{item.operationType}, #{item.taskType}, #{item.auditStatus}, #{item.executeStatus}, #{item.applyBy}, #{item.applyDate}, #{item.applyReason})
( #{item.rawOutstockId}, #{item.taskCode}, #{item.warehouseId}, #{item.locationCode}, #{item.stockTotalId}, #{item.orderId},#{item.saleOrderId}, #{item.planCode}, #{item.planDetailCode}, #{item.stationId}, #{item.materialId}, #{item.materialBatch}, #{item.palletInfoCode}, #{item.outstockAmount}, #{item.endStationCode}, #{item.operationType}, #{item.taskType}, #{item.splitFlag},#{item.auditStatus}, #{item.executeStatus}, #{item.applyBy}, #{item.applyDate}, #{item.applyReason})
</foreach>
</insert>
@ -331,7 +340,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectNewestWmsRawOutstock" parameterType="WmsRawOutstock" resultMap="WmsRawOutstockResult">
select wro.raw_outstock_id,wrod.material_barcode as material_batch from wms_raw_outstock wro left join wms_raw_outstock_detail wrod on wro.raw_outstock_id = wrod.raw_outstock_id
select wro.raw_outstock_id,wrod.material_barcode as material_batch from wms_raw_outstock wro
left join wms_raw_outstock_detail wrod on wro.raw_outstock_id = wrod.raw_outstock_id
<where>
<if test="planCode != null "> and wro.plan_code = #{planCode}</if>
<if test="planDetailCode != null "> and wro.plan_detail_code = #{planDetailCode}</if>

@ -32,6 +32,7 @@
wst.warehouse_floor,
wst.stock_type,
wst.material_id,
wst.sale_order_id,
mbmi.material_code,
mbmi.material_name,
wst.total_amount,

@ -82,17 +82,17 @@ export function uploadFile(data) {
}
// 获取生产派工图纸List列表
export function getDispatchDrawingList(planId) {
export function getDispatchDrawingList(dispatchCode,processId) {
return request({
url: '/mes/productplan/drawingList/' + planId,
url: '/mes/productplan/drawingList/' + dispatchCode+'/'+processId,
method: 'get'
})
}
// 获取生产派工SOP附件List列表
export function getDispatchSOPAttachList(planId) {
export function getDispatchSOPAttachList(dispatchCode,processId) {
return request({
url: '/mes/productplan/SOPAttachList/' + planId,
url: '/mes/productplan/SOPAttachList/' + dispatchCode+'/'+processId,
method: 'get'
})
}

@ -3,12 +3,15 @@
<div class="headTitle">京源环保生产管理系统</div>
<div class="chartBox chartBox1">
<div class="title">生产详细信息</div>
<div class="title">生产明细</div>
<div class="chart">
<div class="form">
<el-form :model="form" label-position="right" label-width="80px">
<el-form-item label="工单编号">
<el-form-item label="派工单号">
<el-input v-model="form.dispatchCode"></el-input>
</el-form-item>
<el-form-item label="计划编号" v-if="false">
<el-input v-model="form.planCode"></el-input>
</el-form-item>
<el-form-item label="明细编号">
@ -20,6 +23,9 @@
<el-form-item label="成品编号">
<el-input v-model="form.materialCode"></el-input>
</el-form-item>
<el-form-item label="规格型号">
<el-input v-model="form.materialSpec"></el-input>
</el-form-item>
<el-form-item label="状态">
<el-input v-model="form.planDetailStatus"></el-input>
</el-form-item>
@ -58,7 +64,7 @@
@click="handleBindBarcode">绑定
</el-button-->
<el-button v-if="($route.query && $route.query.id) !== '2'" type="warning"
:disabled="form.planDetailStatus === '已完成' || !form.planDetailCode" @click="handleRawBack">返库
:disabled="!form.planDetailCode" @click="handleRawBack">返库
</el-button>
<el-button :disabled="form.planDetailStatus === '已完成' || !form.planDetailCode" type="success"
@click="finish">完成
@ -135,8 +141,14 @@
>
</el-table-column>
<el-table-column
label="工单编号"
label="派工单号"
prop="dispatchCode"
>
</el-table-column>
<el-table-column
label="计划编号"
prop="planCode"
v-if="false"
>
</el-table-column>
<el-table-column
@ -167,8 +179,14 @@
</template>
</el-table-column>
<el-table-column
label="交付时间"
prop="planDeliveryDate"
label="计划开始时间"
prop="planBeginTime"
width="150"
>
</el-table-column>
<el-table-column
label="计划技术时间"
prop="planEndTime"
width="150"
>
</el-table-column>
@ -216,7 +234,7 @@
trigger="click">
<div>
<div style="margin: 15px 0;">
<el-input placeholder="请扫描或输入背板条码" v-model="input1" class="input-with-select">
<el-input placeholder="请扫描或输入背板/门板条码" v-model="input1" class="input-with-select">
<el-button slot="append" icon="el-icon-full-screen"></el-button>
</el-input>
</div>
@ -269,7 +287,10 @@
:title="applyMaterialTitle"
width="40%">
<el-form ref="form" :model="form1" label-width="100px">
<el-form-item label="工单编号">
<el-form-item label="派工单号">
<el-input v-model="form1.dispatchCode" disabled></el-input>
</el-form-item>
<el-form-item label="计划编号" v-if="false">
<el-input v-model="form1.planCode" disabled></el-input>
</el-form-item>
<el-form-item label="明细编号">
@ -394,7 +415,8 @@
</el-select>
</el-form-item>
<el-form-item label="柜体条码" prop="materialBarcode">
<el-input v-model="rawBackForm.materialBarcode" suffix-icon="el-icon-full-screen" style="width:380px"></el-input>
<el-input v-model="rawBackForm.materialBarcode" suffix-icon="el-icon-full-screen"
style="width:380px"></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
@ -407,7 +429,7 @@
<el-dialog
:visible.sync="materialConfirmVisible"
title="确认物料使用"
width="40%">
width="500px">
<el-form ref="materialConfirmForm" :model="materialConfirmForm" :rules="materialConfirmRules" label-width="80px">
<el-form-item label="计划ID" prop="planId" v-if="false">
<el-input v-model="materialConfirmForm.planId"></el-input>
@ -416,10 +438,10 @@
<el-input v-model="materialConfirmForm.planDetailId"></el-input>
</el-form-item>
<el-form-item label="物料条码" prop="materialBarcode">
<el-input v-model="materialConfirmForm.materialBarcode"></el-input>
<el-input v-model="materialConfirmForm.materialBarcode" suffix-icon="el-icon-full-screen"></el-input>
</el-form-item>
<el-form-item label="数量" prop="checkAmount">
<el-input v-model="materialConfirmForm.checkAmount"></el-input>
<el-input v-model="materialConfirmForm.checkAmount" disabled></el-input>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
@ -580,7 +602,7 @@ import {
bindBarcode,
applyRawBack,
assignTask, scanMaterial2Confirm, applyRawReturn,
getNewestOutstockCabinet,completeCollectMaterials,completeReturnMaterials
getNewestOutstockCabinet, completeCollectMaterials, completeReturnMaterials
} from "@/api/board";
const setState = (e) => {
@ -644,7 +666,7 @@ export default {
materialBarcode: null,
planId: null,
planDetailId: null,
checkAmount: null
checkAmount: 1
},
materialConfirmRules: {
materialBarcode: [
@ -658,6 +680,10 @@ export default {
tableData: [],
nowStation: null,
loginStationInfo: {},
PROCESS_TYPE: {
FIFTH_SPLIT: '1',
FIFTH_ASSEMBLE: '2'
},
stationData: [
{
stationName: '五楼装配工位1',
@ -959,6 +985,8 @@ export default {
this.form.materialId = val.materialId
this.form.materialCode = val.materialCode
this.form.materialName = val.materialName
this.form.materialSpec = val.materialSpec;
this.form.dispatchCode = val.dispatchCode;
this.form.planDetailStatus = setState(data.data.planDetailStatus)
this.getInfo(val)
},
@ -967,7 +995,7 @@ export default {
},
async startPlan1(val) {
if (!this.input1 || this.input1 == null || this.input1 == undefined || this.input1 == '') {
this.$modal.msgWarning("请扫描或输入物料条码");
this.$modal.msgWarning("请扫描或输入背板/门板条码");
return;
}
await this.startPlan(val, this.input1);
@ -994,7 +1022,9 @@ export default {
this.form.materialId = val.materialId
this.form.materialCode = val.materialCode
this.form.materialName = val.materialName
this.form.materialSpec = val.materialSpec
this.form.saleOrderId = val.saleOrderId
this.form.dispatchCode = val.dispatchCode;
if (data) {
this.form.planDetailStatus = setState(data.planDetailStatus)
}
@ -1357,14 +1387,17 @@ export default {
})
},
async finish() {
let processType = this.$route.query && this.$route.query.id && this.$route.query.id === '2'
? this.PROCESS_TYPE.FIFTH_ASSEMBLE : this.PROCESS_TYPE.FIFTH_SPLIT;
this.$confirm('确认计划完成?', '提示', {
this.$confirm('确认明细完成?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(async () => {
const data = await completeProductPlanDetail({
planDetailId: this.form.planDetailId
planDetailId: this.form.planDetailId,
processType: processType
})
if (data.code === 200) {
this.$message({
@ -1378,10 +1411,6 @@ export default {
this.tableClick(e.rows.find(v => v.planCode === this.form.planCode))
})
}).catch(() => {
this.$message({
type: 'info',
message: '已取消'
});
});
},
@ -1409,7 +1438,7 @@ export default {
saleOrderId: this.form?.saleOrderId,
applyReason: '',
taskType: '1',
stationId :this.loginStationInfo.stationId,
stationId: this.loginStationInfo.stationId,
endStationCode: this.loginStationInfo.stationCode,
wmsRawOutstockDetailList: []
}
@ -1458,19 +1487,17 @@ export default {
receiveMaterial() {
this.form1.taskType = this.taskType;
applyRawOutstock(this.form1).then(e => {
if (e.code === 200) {
this.dialogVisible = false
this.$message({
message: '申请领取成功',
type: 'success'
});
}
this.dialogVisible = false
this.$message({
message: '申请领取成功',
type: 'success'
});
})
},
print() {
getNewestOutstockCabinet({planDetailCode:this.form.planDetailCode}).then(response => {
if(!response.data){
getNewestOutstockCabinet({planDetailCode: this.form.planDetailCode}).then(response => {
if (!response.data || !response.data.materialBatch || response.data.materialBatch ==='') {
this.$modal.msgWarning("请先领取柜体");
return;
}
@ -1568,7 +1595,7 @@ export default {
materialBarcode: null,
planId: null,
planDetailId: null,
checkAmount: null
checkAmount: 1
};
this.resetForm("materialConfirmForm");
},
@ -1579,7 +1606,7 @@ export default {
materialBarcode: null,
planId: this.form.planId,
planDetailId: this.form.planDetailId,
checkAmount: null
checkAmount: 1
};
this.materialConfirmVisible = true;
},
@ -1707,13 +1734,15 @@ export default {
},
completeCollectMaterials() {
completeCollectMaterials({endStationCode:this.loginStationInfo.stationCode}).then(v => {
// const loginStationCode = this.loginStationInfo.stationCode;
const loginStationCode = 'ZP_06';//todo
completeCollectMaterials({endStationCode: loginStationCode}).then(v => {
this.$modal.msgSuccess("操作成功");
})
},
completeReturnMaterials() {
completeReturnMaterials({endStationCode:this.loginStationInfo.stationCode}).then(v => {
completeReturnMaterials({endStationCode: this.loginStationInfo.stationCode}).then(v => {
this.$modal.msgSuccess("操作成功");
})
},

@ -143,12 +143,12 @@ export default {
{
floor: 5,
processId: 51,
route: '/board/fifthFloor'
route: '/board/fifthFloor'//
},
{
floor: 5,
processId: 52,
route: '/board/fifthFloor?id=2'
route: '/board/fifthFloor?id=2'//
}
]
};

@ -279,7 +279,7 @@
<el-input v-model="form.orderCode" placeholder="请输入工单编号" :disabled="true"/>
</el-form-item>
<el-form-item label="销售类型" prop="saleType">
<el-radio-group v-model="form.saleType" @input="changeSaleType">
<el-radio-group v-model="form.saleType">
<el-radio
v-for="dict in dict.type.mes_sale_type"
:key="dict.value"
@ -346,7 +346,8 @@
</el-date-picker>
</el-form-item>
<el-form-item label="前置生产工单" prop="preOrderCode">
<el-input v-model="form.preOrderCode" placeholder="请点击右侧检索生产工单" :disabled="productOrderDisabled" readonly>
<el-input v-model="form.preOrderCode" placeholder="请点击右侧检索生产工单" :disabled="productOrderDisabled"
readonly>
<el-button slot="append" icon="el-icon-search" @click="handleProductOrderAdd"></el-button>
</el-input>
</el-form-item>
@ -429,7 +430,8 @@
</el-date-picker>
</el-form-item>
<el-form-item label="前置生产工单" prop="preOrderCode">
<el-input v-model="form.preOrderCode" placeholder="请点击右侧检索生产工单" :disabled="productOrderDisabled" readonly>
<el-input v-model="form.preOrderCode" placeholder="请点击右侧检索生产工单" :disabled="productOrderDisabled"
readonly>
<el-button slot="append" icon="el-icon-search" @click="handleProductOrderAdd"></el-button>
</el-input>
</el-form-item>
@ -671,13 +673,13 @@ export default {
},
MES_ORDER_STATUS: {
UNPUBLISH : '0',//
PUBLISHED : '1',//
FINISHED : '2',//
UNPUBLISH: '0',//
PUBLISHED: '1',//
FINISHED: '2',//
STARTED: '3',//
PAUSE: '4', //
RECALLED: '5',//
DELETED : '9',//
DELETED: '9',//
}
};
},
@ -753,10 +755,10 @@ export default {
},
/** 新增按钮操作 */
handleSaleOrderAdd() {
if (this.form.saleType === null || this.form.saleType === undefined || this.form.saleType === '') {
this.$modal.msgWarning("请先选择销售类型!");
return;
}
// if (this.form.saleType === null || this.form.saleType === undefined || this.form.saleType === '') {
// this.$modal.msgWarning("");
// return;
// }
this.saleOrderOpen = true;
},
//
@ -804,12 +806,12 @@ export default {
this.$modal.msgError("该销售订单销售成品信息不存在!");
return;
}
if (this.form.saleType && this.form.saleType === this.MES_SALE_TYPE.MES_SALE_TYPE_EXTERNAL) {
this.form.materialId = selectedRow.materialId;
this.form.materialCode = selectedRow.materialCode;
this.form.materialName = selectedRow.materialName;
this.getMaterialVisionList();
}
this.form.materialId = selectedRow.materialId;
this.form.materialCode = selectedRow.materialCode;
this.form.materialName = selectedRow.materialName;
this.getMaterialVisionList();
this.saleOrderOpen = false;
},
@ -819,7 +821,7 @@ export default {
let selectedRow = this.$refs.productOrderRef.selectedRow;
this.form.preOrderId = selectedRow.saleOrderId;
this.form.preOrderCode = selectedRow.orderCode;
if (selectedRow.planBeginTime != null && this.form.planBeginTime == null){
if (selectedRow.planBeginTime != null && this.form.planBeginTime == null) {
const date = new Date(selectedRow.planBeginTime);
date.setDate(date.getDate() + 1)
this.form.planBeginTime = parseTime(date, '{y}-{m}-{d} {h}:{i}:{s}');
@ -841,14 +843,7 @@ export default {
this.form.materialBomId = null;
this.form.dispatchId = null;
this.form.saleOrderFlag = '1';//
this.saleOrderDisabled = false;
if (value == this.MES_SALE_TYPE.MES_SALE_TYPE_EXTERNAL) {
this.materialDisabled = true;
} else {
this.materialDisabled = false;
}
},
getMaterialVisionList() {
@ -979,10 +974,11 @@ export default {
this.$tab.closeOpenPage(router.currentRoute);
this.$tab.openPage("工单[" + orderCode + "]排产", '/mes/production-scheduling/index/' + productOrderId, params);
},
/** 提交按钮 */
/** 销售订单新增提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
//
if (this.form.saleOrderFlag === '1' && this.form.saleAmount < this.form.planAmount) {
return this.$modal.msgError("计划数量不能大于销售数量!");
}
@ -1027,11 +1023,11 @@ export default {
/** 暂停 */
handlePause(row){
handlePause(row) {
},
handleContinue(row){
handleContinue(row) {
},

@ -115,13 +115,14 @@
<el-table-column align="center" label="派工标准工时(小时)" prop="productionTime" width="180">
<template slot-scope="scope">
<el-input-number style="width:150px;" :min="0" v-model="scope.row.productionTime" :disabled="scope.row.children != null && scope.row.children !== undefined"/>
<el-input-number style="width:150px;" :min="0" v-model="scope.row.productionTime"
:disabled="scope.row.processType === PROCESS_TYPE.MANUAL && scope.row.children != null && scope.row.children !== undefined"/>
</template>
</el-table-column>
<el-table-column align="center" label="计划开始时间" prop="planBeginTime" width="230">
<template slot-scope="scope">
<el-date-picker v-model="scope.row.planBeginTime" style="width:200px;"
:disabled="scope.row.children != null && scope.row.children !== undefined"
:disabled="scope.row.processType === PROCESS_TYPE.MANUAL && scope.row.children != null && scope.row.children !== undefined"
clearable
placeholder="请选择计划开始时间"
type="datetime" value-format="yyyy-MM-dd HH:mm:ss"
@ -131,7 +132,7 @@
<el-table-column align="center" label="计划完成时间" prop="planEndTime" width="230">
<template slot-scope="scope">
<el-date-picker v-model="scope.row.planEndTime" style="width:200px;"
:disabled="scope.row.children != null && scope.row.children !== undefined"
:disabled="scope.row.processType === PROCESS_TYPE.MANUAL && scope.row.children != null && scope.row.children !== undefined"
clearable
placeholder="请选择计划完成时间"
type="datetime" value-format="yyyy-MM-dd HH:mm:ss"/>
@ -159,7 +160,7 @@
size="mini"
type="primary"
@click="handleDrawing(scope.row)"
v-if="scope.row.children != null && scope.row.children !== undefined"
v-if="scope.row.processType !== PROCESS_TYPE.AUTO && scope.row.children != null && scope.row.children !== undefined"
>图纸
</el-button>
<el-button
@ -167,7 +168,7 @@
size="mini"
type="success"
@click="handleSOP(scope.row)"
v-if="scope.row.children != null && scope.row.children !== undefined"
v-if="scope.row.processType !== PROCESS_TYPE.AUTO && scope.row.children != null && scope.row.children !== undefined"
>SOP
</el-button>
@ -185,7 +186,6 @@
</el-table-column>
</el-table>
</el-form>
<el-form label-width="100px">
@ -271,7 +271,7 @@
:limit="limit"
:headers="headers"
:before-upload="handleBeforeUpload"
:http-request="httpRequest"
:http-request="httpSopRequest"
:on-exceed="handleExceed"
:file-list="fileList"
>
@ -455,8 +455,18 @@ export default {
},
//
fileList: [],
//
uploadList: [],
// Sop
groupSopFile: {},
// Sop
groupSopFileList: [],
//
groupAttachFile: {},
//
groupAttachFileList: [],
//
uploadAttachList: [],
// SOP
uploadSopList: [],
//-
addProductPlanObject: {},
headers: {
@ -537,21 +547,24 @@ export default {
let obj = {};
let dispatchCode = dispatchCodeProcessId.split("-")[0];
if(!firstDispatch[dispatchCode]){
if (!firstDispatch[dispatchCode]) {
firstDispatch[dispatchCode] = "1";
obj.deleteFlag = "1";
}
obj.id = this.id
this.id = this.id + 1;
let i = 0;
let processType;
productPlansByDispatch.forEach(groupedProductPlan => {
processType = groupedProductPlan.processType;
groupedProductPlan.id = this.id;
groupedProductPlan.productionTime = groupedProductPlan.productionTime/60/60;
this.id = this.id + 1;
groupedProductPlan.productionTime = groupedProductPlan.productionTime / 60 / 60;
obj.sopId = groupedProductPlan.sopId;
obj.attachId = groupedProductPlan.attachId;
if (i === 0) {
if (i === 0 || groupedProductPlan.processType !== this.PROCESS_TYPE.MANUAL) {
obj.dispatchCode = groupedProductPlan.dispatchCode;
obj.dispatchAmount = groupedProductPlan.dispatchAmount;
obj.processId = groupedProductPlan.processId;
@ -572,17 +585,26 @@ export default {
obj.saleorderCode = this.form.saleorderCode;
// false=true=
obj.oldRowFlag = true;
if (groupedProductPlan.processType !== this.PROCESS_TYPE.MANUAL) {
let cloneObj = deepClone(obj);
cloneObj.id = this.id
cloneObj.planId = groupedProductPlan.planId;
cloneObj.productionTime = groupedProductPlan.productionTime / 60 / 60;
this.id = this.id + 1;
cloneObj.children = [];
this.mesProductPlanList.push(cloneObj);
}
i++;
}
});
obj.children = productPlansByDispatch;
this.mesProductPlanList.push(obj);
if (processType === this.PROCESS_TYPE.MANUAL) {
obj.children = productPlansByDispatch;
this.mesProductPlanList.push(obj);
}
}
// console.log(JSON.stringify(this.mesProductPlanList))
this.getId(this.mesProductPlanList);
},
@ -633,10 +655,11 @@ export default {
/** 提交按钮 */
submitForm() {
// let dataList = this.mesProductPlanList.filter(plan => !plan.oldRowFlag);
// if (dataList.length === 0) {
// this.close();
// return;
// }
if (this.mesProductPlanList.length === 0) {
this.$modal.msgError("无派工信息提交");
return;
}
let dataList = this.mesProductPlanList;
let toUpdatedProductPlans = [];
let undispathDesc;
@ -645,37 +668,45 @@ export default {
let dispatchFlag = false;
undispathDesc = "派工单号为[" + e.dispatchCode + "],工序为[" + e.processName + "],请选择用户派工";
if (!e.children || e.children.length <= 0) {
this.$modal.msgError(undispathDesc);
return;
}
for (let j = 0; j < e.children.length; j++) {
let processUser = e.children[j];
let toUpdatedProductPlan = deepClone(e);
if (processUser.userId && processUser.userId !== '') {
toUpdatedProductPlan.userId = processUser.userId;
toUpdatedProductPlan.planBeginTime = processUser.planBeginTime;
toUpdatedProductPlan.planEndTime = processUser.planEndTime;
toUpdatedProductPlan.planId = processUser.planId;
toUpdatedProductPlan.children = null;
let productionTimeHour = processUser.productionTime;
let productionTimeSecond = productionTimeHour*60*60;
toUpdatedProductPlan.productionTime = productionTimeSecond;
toUpdatedProductPlans.push(toUpdatedProductPlan);
dispatchFlag = true;
} else {
if (e.processType !== this.PROCESS_TYPE.AUTO) {
if (!e.children || e.children.length <= 0) {//线
this.$modal.msgError(undispathDesc);
return;
}
for (let j = 0; j < e.children.length; j++) {
let processUser = e.children[j];
let toUpdatedProductPlan = deepClone(e);
if (processUser.userId && processUser.userId !== '') {
toUpdatedProductPlan.userId = processUser.userId;
toUpdatedProductPlan.planBeginTime = processUser.planBeginTime;
toUpdatedProductPlan.planEndTime = processUser.planEndTime;
toUpdatedProductPlan.planId = processUser.planId;
toUpdatedProductPlan.attachId = e.attachId;
toUpdatedProductPlan.sopId = e.sopId;
toUpdatedProductPlan.children = null;
let productionTimeHour = processUser.productionTime;
let productionTimeSecond = productionTimeHour * 60 * 60;
toUpdatedProductPlan.productionTime = productionTimeSecond;
toUpdatedProductPlans.push(toUpdatedProductPlan);
dispatchFlag = true;
} else {
this.$modal.msgError(undispathDesc);
return;
}
}
} else {
toUpdatedProductPlans.push(e);
}
if (toUpdatedProductPlans.length <= 0) {
this.$modal.msgError("无派工信息提交");
return;
}
}
if (toUpdatedProductPlans.length <= 0) {
this.$modal.msgError("无派工信息提交");
return;
}
// ( + <= )
@ -685,7 +716,7 @@ export default {
let processId = planData.processId;
let newFlag = planData.newFlag;
let dispatchAmount = planData.dispatchAmount;
if(newFlag && newFlag === "1"){
if (newFlag && newFlag === "1") {
dispatchAmount = dispatchAmount == null || dispatchAmount === '' ? 0 : dispatchAmount;
const numericAmount = parseInt(dispatchAmount, 10);
if (!this.isPositiveInteger(numericAmount) || numericAmount <= 0) {
@ -716,7 +747,7 @@ export default {
this.$modal.msgError("每个工序的派工数量之和需小于等于该工单计划数量!");
return;
}
} else if(uniqueSum.size >1){
} else if (uniqueSum.size > 1) {
this.$modal.msgError("每个工序的派工数量之和需相等!");
return;
}
@ -728,7 +759,12 @@ export default {
orderAddMesProductPlanList(
{productOrderId:this.form.productOrderId,dispatchAmount:currentDispatchAmount,mesProductPlanList: toUpdatedProductPlans, toDeletedPlanIds: this.toDeletedPlanIds})
{
productOrderId: this.form.productOrderId,
dispatchAmount: currentDispatchAmount,
mesProductPlanList: toUpdatedProductPlans,
toDeletedPlanIds: this.toDeletedPlanIds
})
.then(res => {
this.$modal.msgSuccess(res.msg);
this.close();
@ -754,7 +790,7 @@ export default {
const planIds = this.mesProductPlanList.filter(function (item) {
return scope.row.dispatchCode === item.dispatchCode
}).map(item => {
if (item.planStatus !== this.PLAN_STATUS.DISPATCHED && item.planStatus!== this.PLAN_STATUS.TO_DISPATCH) {
if (item.planStatus !== this.PLAN_STATUS.DISPATCHED && item.planStatus !== this.PLAN_STATUS.TO_DISPATCH) {
throw Error("只能删除还未开始过状态的生产派工单!");
}
@ -762,7 +798,11 @@ export default {
return item.planId;
});
deleteProductPlansByDispatchCode({productOrderId:this.form.productOrderId,dispatchCode:dispatchCode,dispatchAmount:dispatchSum}).then(res => {
deleteProductPlansByDispatchCode({
productOrderId: this.form.productOrderId,
dispatchCode: dispatchCode,
dispatchAmount: dispatchSum
}).then(res => {
this.mesProductPlanList = this.mesProductPlanList.filter(function (item) {
return dispatchCode !== item.dispatchCode
});
@ -793,45 +833,7 @@ export default {
const obj = {path: "/mes/plan/productOrder", query: {t: Date.now(), queryParams: this.$route.query.queryParams}};
this.$tab.closeOpenPage(obj);
},
/** 查看图纸 */
handleDrawing(row) {
this.fileList = [];
this.uploadList = [];
if (row.planId != null) {
getDispatchDrawingList(row.planId).then(res => {
let attachList = res.data;
attachList.forEach(e => {
let previewFile = {};
previewFile.url = e.attachPath;
previewFile.name = e.attachName;
this.fileList.push(previewFile);
this.uploadList.push(e.attachId);
})
})
}
this.addProductPlanObject = row;
this.blueprintModel = true;
},
/** 查看SOP附件 */
handleSOP(row) {
this.fileList = [];
this.uploadList = [];
if (row.planId != null) {
getDispatchSOPAttachList(row.planId).then(res => {
let attachList = res.data;
attachList.forEach(e => {
let previewFile = {};
previewFile.url = e.attachPath;
previewFile.name = e.attachName;
this.fileList.push(previewFile);
this.uploadList.push(e.attachId);
})
})
}
this.addProductPlanObject = row;
this.sopViewModel = true;
},
/** 生产计划添加按钮操作 */
handleAddMesProductPlan() {
@ -846,8 +848,8 @@ export default {
let i = 0;
res.data.forEach((e, index) => {
let obj = {};
if(i===0){
obj.deleteFlag = "1";
if (i === 0) {
obj.deleteFlag = "1";//
i++;
}
obj.id = this.id
@ -880,11 +882,16 @@ export default {
// this.id = this.id + 1;
// });
obj.children = [{
id: this.id,
processId: obj.processId,
planStatus: this.PLAN_STATUS.DISPATCHED
}]
if (e.processType === this.PROCESS_TYPE.AUTO) {
obj.children = [];
} else {
obj.children = [{
id: this.id,
processId: obj.processId,
planStatus: this.PLAN_STATUS.DISPATCHED
}]
}
this.id += 1;
@ -921,53 +928,98 @@ export default {
handleDownload(file) {
window.open(file.url);
},
/** 查看图纸 */
handleDrawing(row) {
this.fileList = [];
this.uploadAttachList = [];
if (row.oldRowFlag) {
getDispatchDrawingList(row.dispatchCode, row.processId).then(res => {
let attachList = res.data;
attachList.forEach(e => {
let previewFile = {};
previewFile.url = e.attachPath;
previewFile.name = e.attachName;
this.fileList.push(previewFile);
this.uploadAttachList.push(e.attachId);
})
})
}
this.groupAttachFileList.forEach(e => {
if (e.dispatchCode === row.dispatchCode && e.processId === row.processId) {
let previewFile = {};
previewFile.url = e.attachPath;
previewFile.name = e.attachName;
this.fileList.push(previewFile);
this.uploadAttachList.push(e.attachId);
}
})
this.addProductPlanObject = row;
this.blueprintModel = true;
},
/** 查看SOP附件 */
handleSOP(row) {
this.fileList = [];
this.uploadSopList = [];
if (row.oldRowFlag) {
getDispatchSOPAttachList(row.dispatchCode, row.processId).then(res => {
let attachList = res.data;
attachList.forEach(e => {
let previewFile = {};
previewFile.url = e.attachPath;
previewFile.name = e.attachName;
this.fileList.push(previewFile);
this.uploadSopList.push(e.attachId);
})
})
}
this.groupSopFileList.forEach(e => {
if (e.dispatchCode === row.dispatchCode && e.processId === row.processId) {
let previewFile = {};
previewFile.url = e.attachPath;
previewFile.name = e.attachName;
this.fileList.push(previewFile);
this.uploadSopList.push(e.attachId);
}
})
this.addProductPlanObject = row;
this.sopViewModel = true;
},
//
drawingFileUploadSubmit() {
// false=true=
if (this.addProductPlanObject.oldRowFlag) {
updateProductplan({
planId: this.addProductPlanObject.planId,
attachId: this.uploadList.join(","),
}).then(res => {
this.$modal.msgSuccess("上传图纸成功!");
}
)
} else {
for (let i = 0; i < this.mesProductPlanList.length; i++) {
if (this.mesProductPlanList[i].index === this.addProductPlanObject.index) {
this.mesProductPlanList[i].attachId = this.uploadList.join(",");
}
for (let i = 0; i < this.mesProductPlanList.length; i++) {
let mesProductPlan = this.mesProductPlanList[i];
if (mesProductPlan.dispatchCode === this.addProductPlanObject.dispatchCode
&& mesProductPlan.processId === this.addProductPlanObject.processId) {
this.mesProductPlanList[i].attachId = this.uploadAttachList.join(",");
}
}
this.uploadList = [];
this.uploadAttachList = [];
this.addProductPlanObject = null;
this.blueprintModel = false;
},
//SOP
sopFileUploadSubmit() {
// false=true=
if (this.addProductPlanObject.oldRowFlag) {
updateProductplan({
planId: this.addProductPlanObject.planId,
sopId: this.uploadList.join(","),
}).then(res => {
this.$modal.msgSuccess("上传SOP附件成功");
}
)
} else {
for (let i = 0; i < this.mesProductPlanList.length; i++) {
if (this.mesProductPlanList[i].index === this.addProductPlanObject.index) {
this.mesProductPlanList[i].sopId = this.uploadList.join(",");
}
for (let i = 0; i < this.mesProductPlanList.length; i++) {
let mesProductPlan = this.mesProductPlanList[i];
if (mesProductPlan.dispatchCode === this.addProductPlanObject.dispatchCode
&& mesProductPlan.processId === this.addProductPlanObject.processId) {
this.mesProductPlanList[i].sopId = this.uploadSopList.join(",");
}
}
this.uploadList = [];
this.uploadSopList = [];
this.addProductPlanObject = null;
this.sopViewModel = false;
},
//
//
httpRequest(file) {
//
const fileData = file.file;
@ -978,13 +1030,48 @@ export default {
uploadFile(formData).then(
(res) => {
//
this.uploadList.push(res.attachId);
let groupAttachFile = {};
groupAttachFile.dispatchCode = this.addProductPlanObject.dispatchCode;
groupAttachFile.processId = this.addProductPlanObject.processId;
groupAttachFile.attachId = res.attachId;
groupAttachFile.attachPath = res.imgUrl;
groupAttachFile.attachName = res.fileName;
this.groupAttachFileList.push(groupAttachFile);
this.uploadAttachList.push(res.attachId);
}, (err) => {
this.$refs.drawingUpload.clearFiles(); //
this.$modal.closeLoading();
}
);
},
//SOP
httpSopRequest(file) {
//
const fileData = file.file;
const formData = new FormData();
formData.append("file", fileData);
formData.append("processId", this.addProductPlanObject.processId);
formData.append("attachType", "1");
uploadFile(formData).then(
(res) => {
//
let groupSopFile = {};
groupSopFile.dispatchCode = this.addProductPlanObject.dispatchCode;
groupSopFile.processId = this.addProductPlanObject.processId;
groupSopFile.attachId = res.attachId;
groupSopFile.attachPath = res.imgUrl;
groupSopFile.attachName = res.fileName;
this.groupSopFileList.push(groupSopFile);
this.uploadSopList.push(res.attachId);
}, (err) => {
this.$refs.drawingUpload.clearFiles(); //
this.$modal.closeLoading();
}
);
},
//
uploadedSuccessfully() {
if (this.number > 0 && this.uploadList.length === this.number) {

Loading…
Cancel
Save