定时任务:物料自动出库
master
xs 8 months ago
parent bb9851443b
commit 830e7c4698

@ -179,4 +179,17 @@ public interface RemoteMesService {
public R<MesBaseBarcodeInfo> getBarcodeInfoByBindBarcode(@PathVariable("bindBarcode") String bindBarcode, @RequestHeader(SecurityConstants.FROM_SOURCE) String source); public R<MesBaseBarcodeInfo> getBarcodeInfoByBindBarcode(@PathVariable("bindBarcode") String bindBarcode, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
/**
*
*
* @param dateStr (yyyy-MM-dd)
* @param source
* @return
*/
@GetMapping("/purchaseOrder/autoOutstockLastPurchaseOrders/{dateStr}")
public R<MesBaseBarcodeInfo> autoOutstockLastPurchaseOrders(@PathVariable("dateStr") String dateStr, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
} }

@ -100,6 +100,11 @@ public class RemoteMesFallbackFactory implements FallbackFactory<RemoteMesServic
public R<MesBaseBarcodeInfo> getBarcodeInfoByBindBarcode(String bindBarcode, String source) { public R<MesBaseBarcodeInfo> getBarcodeInfoByBindBarcode(String bindBarcode, String source) {
return R.fail("根据成品条码信息获取原材料条码失败:" + throwable.getMessage()); return R.fail("根据成品条码信息获取原材料条码失败:" + throwable.getMessage());
} }
@Override
public R<MesBaseBarcodeInfo> autoOutstockLastPurchaseOrders(String dateStr, String source) {
return R.fail("自动出库之前采购订单的物料信息失败:" + throwable.getMessage());
}
}; };
} }
} }

@ -5,6 +5,7 @@ import com.hw.common.core.constant.ServiceNameConstants;
import com.hw.common.core.domain.R; import com.hw.common.core.domain.R;
import com.hw.common.core.web.domain.AjaxResult; import com.hw.common.core.web.domain.AjaxResult;
import com.hw.wms.api.domain.WmsWarehouseMaterial; import com.hw.wms.api.domain.WmsWarehouseMaterial;
import com.hw.wms.api.domain.vo.WmsAutoOutstockVo;
import com.hw.wms.api.domain.vo.WmsProductStockVo; import com.hw.wms.api.domain.vo.WmsProductStockVo;
import com.hw.wms.api.domain.vo.WmsRawStockVo; import com.hw.wms.api.domain.vo.WmsRawStockVo;
import com.hw.wms.api.factory.RemoteWmsFallbackFactory; import com.hw.wms.api.factory.RemoteWmsFallbackFactory;
@ -69,4 +70,9 @@ public interface RemoteWmsService {
@PostMapping("/productoutstock/isProductOutstock") @PostMapping("/productoutstock/isProductOutstock")
public R<Boolean> isProductOutstock(@Validated @RequestBody WmsProductStockVo queryProductStockVo, @RequestHeader(SecurityConstants.FROM_SOURCE) String source); public R<Boolean> isProductOutstock(@Validated @RequestBody WmsProductStockVo queryProductStockVo, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
@PostMapping("/rawstock/autoOutstock")
public R<?> autoOutstock(@Validated @RequestBody WmsAutoOutstockVo wmsAutoOutstockVo, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
} }

@ -0,0 +1,16 @@
package com.hw.wms.api.domain.vo;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
@Data
public class WmsAutoOutstockVo {
@NotBlank(message="采购订单号不能为空")
private String poNo;
@NotEmpty(message="物料ID不能为空")
private Long materialId;
}

@ -4,6 +4,7 @@ import com.hw.common.core.domain.R;
import com.hw.common.core.web.domain.AjaxResult; import com.hw.common.core.web.domain.AjaxResult;
import com.hw.wms.api.RemoteWmsService; import com.hw.wms.api.RemoteWmsService;
import com.hw.wms.api.domain.WmsWarehouseMaterial; import com.hw.wms.api.domain.WmsWarehouseMaterial;
import com.hw.wms.api.domain.vo.WmsAutoOutstockVo;
import com.hw.wms.api.domain.vo.WmsProductStockVo; import com.hw.wms.api.domain.vo.WmsProductStockVo;
import com.hw.wms.api.domain.vo.WmsRawStockVo; import com.hw.wms.api.domain.vo.WmsRawStockVo;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -65,6 +66,11 @@ public class RemoteWmsFallbackFactory implements FallbackFactory<RemoteWmsServic
return R.fail("获取成品出库记录失败:" + throwable.getMessage()); return R.fail("获取成品出库记录失败:" + throwable.getMessage());
} }
@Override
public R<?> autoOutstock(WmsAutoOutstockVo wmsAutoOutstockVo, String source) {
return R.fail("自动出库失败:" + throwable.getMessage());
}
}; };
} }
} }

@ -219,7 +219,7 @@ public class MesConstants {
* *
*/ */
public static final String MES_PURCHASE_ORDER_STATUS_TOPURCHASE = "1";//待采购 public static final String MES_PURCHASE_ORDER_STATUS_TOPURCHASE = "1";//待采购
public static final String MES_PURCHASE_ORDER_STATUS_AUTO_OUTSTOCK_COMPLETE = "4";//自动出库完成
/** /**
* (1, 3,) * (1, 3,)
@ -280,4 +280,10 @@ public class MesConstants {
*/ */
public static final String MES_PRODUCT_ORDER_CABINET_CHANNEL_PURCHASE = "1";//外部采购 public static final String MES_PRODUCT_ORDER_CABINET_CHANNEL_PURCHASE = "1";//外部采购
public static final String MES_PRODUCT_ORDER_CABINET_CHANNEL_INTERNAL = "2";//内部生产 public static final String MES_PRODUCT_ORDER_CABINET_CHANNEL_INTERNAL = "2";//内部生产
/**
*
*/
public static final String MES_MATERIAL_AUTO_OUTSTOCK_FLAG_YES="1";
} }

@ -192,6 +192,8 @@ public class WmsConstants {
public static final String WMS_RAW_OUTSTOCK_TASK_TYPE_PRODUCTION_INSTALL = "3";//组装出库 public static final String WMS_RAW_OUTSTOCK_TASK_TYPE_PRODUCTION_INSTALL = "3";//组装出库
public static final String WMS_RAW_OUTSTOCK_TASK_TYPE_AUTO_OUTSTOCK = "4";//自动出库
public static final String WMS_RAW_OUTSTOCK_TASK_TYPE_OTHER = "9";//其他 public static final String WMS_RAW_OUTSTOCK_TASK_TYPE_OTHER = "9";//其他
public static final String WMS_RAW_OUTSTOCK_TASK_TYPE_MOVE = "2";//移库出库,暂时不用 public static final String WMS_RAW_OUTSTOCK_TASK_TYPE_MOVE = "2";//移库出库,暂时不用

@ -1,16 +1,20 @@
package com.hw.job.task; package com.hw.job.task;
import com.hw.common.core.constant.SecurityConstants; import com.hw.common.core.constant.SecurityConstants;
import com.hw.common.core.utils.DateUtils;
import com.hw.dms.api.RemoteDmsService; import com.hw.dms.api.RemoteDmsService;
import com.hw.ems.api.RemoteEmsService; import com.hw.ems.api.RemoteEmsService;
import com.hw.jindie.api.RemoteJindieService; import com.hw.jindie.api.RemoteJindieService;
import com.hw.jindie.api.domain.vo.ErpSyncInfoVo; import com.hw.jindie.api.domain.vo.ErpSyncInfoVo;
import com.hw.mes.api.RemoteMesService;
import com.hw.wms.api.RemoteWmsService; import com.hw.wms.api.RemoteWmsService;
import io.swagger.models.auth.In; import io.swagger.models.auth.In;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import com.hw.common.core.utils.StringUtils; import com.hw.common.core.utils.StringUtils;
import java.util.Date;
/** /**
* *
* *
@ -27,7 +31,8 @@ public class RyTask
private RemoteJindieService remoteJindieService; private RemoteJindieService remoteJindieService;
@Autowired @Autowired
private RemoteWmsService remoteWmsService; private RemoteWmsService remoteWmsService;
@Autowired
private RemoteMesService remoteMesService;
public void ryMultipleParams(String s, Boolean b, Long l, Double d, Integer i) public void ryMultipleParams(String s, Boolean b, Long l, Double d, Integer i)
{ {
@ -133,4 +138,11 @@ public class RyTask
remoteDmsService.getDmsAlarmNotificationScheduledTask(SecurityConstants.INNER); remoteDmsService.getDmsAlarmNotificationScheduledTask(SecurityConstants.INNER);
} }
public void autoOutstock(String dateStr){
if (StringUtils.isEmpty(dateStr)) {
dateStr = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, new Date());
}
remoteMesService.autoOutstockLastPurchaseOrders(dateStr,SecurityConstants.INNER);
}
} }

@ -3,7 +3,7 @@ package com.hw.mes.controller;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.hw.mes.api.domain.MesOrderBind; import com.hw.common.core.domain.R;
import com.hw.mes.domain.MesSaleOrder; import com.hw.mes.domain.MesSaleOrder;
import com.hw.mes.service.IMesOrderBindService; import com.hw.mes.service.IMesOrderBindService;
import com.hw.mes.service.IMesSaleOrderService; import com.hw.mes.service.IMesSaleOrderService;
@ -233,4 +233,18 @@ public class MesPurchaseOrderController extends BaseController
return getDataTable(list); return getDataTable(list);
} }
/**
* raw_instock(group by)
*/
// @InnerAuth
@GetMapping(value="/autoOutstockLastPurchaseOrders/{dateStr}")
public R<?> autoOutstockLastPurchaseOrders(@PathVariable("dateStr") String dateStr)
{
return R.ok(mesPurchaseOrderService.autoOutstockLastPurchaseOrders(dateStr));
}
} }

@ -133,4 +133,14 @@ public interface MesPurchaseOrderMapper
*/ */
public List<MesPurchaseOrder> selectPurchaseOrderJoinList(MesPurchaseOrder mesPurchaseOrder); public List<MesPurchaseOrder> selectPurchaseOrderJoinList(MesPurchaseOrder mesPurchaseOrder);
/**
*
* @param applyDateStr
* @return
*/
public List<MesPurchaseOrder> selectNotRawInstockPurchaseOrderList(String applyDateStr);
} }

@ -143,4 +143,11 @@ public interface IMesPurchaseOrderService
* @return * @return
*/ */
public List<MesPurchaseOrder> selectPurchaseOrderJoinList(MesPurchaseOrder mesPurchaseOrder); public List<MesPurchaseOrder> selectPurchaseOrderJoinList(MesPurchaseOrder mesPurchaseOrder);
/**
* raw_instock(group by)
* @param dateStr
* @return List<MesPurchaseOrder>
*/
public int autoOutstockLastPurchaseOrders(String dateStr);
} }

@ -267,7 +267,7 @@ public class MesImportImpl implements IMesImportService {
// IOUtils.closeQuietly(is); // IOUtils.closeQuietly(is);
// } // }
return "BOM导入成功"; return "导入成功";
} }
/** /**
@ -311,6 +311,7 @@ public class MesImportImpl implements IMesImportService {
productBom = productBom.replaceAll(".*?", ""); productBom = productBom.replaceAll(".*?", "");
productBom = productBom.replaceAll("(.*?)", "");
MesBaseMaterialInfo productMaterial = mesBaseMaterialInfoMapper.selectMesBaseMaterialInfoByMaterialCode(productBom); MesBaseMaterialInfo productMaterial = mesBaseMaterialInfoMapper.selectMesBaseMaterialInfoByMaterialCode(productBom);
if (productMaterial == null) { if (productMaterial == null) {
throw new ServiceException("Excel格式错误:物料编号:" + productBom + "的信息不存在!"); throw new ServiceException("Excel格式错误:物料编号:" + productBom + "的信息不存在!");
@ -378,7 +379,18 @@ public class MesImportImpl implements IMesImportService {
materialBom.setMaterialBomDesc(parentBomDesc); materialBom.setMaterialBomDesc(parentBomDesc);
materialBom.setParentId(parentBomId); materialBom.setParentId(parentBomId);
materialBom.setActiveFlag("1"); materialBom.setActiveFlag("1");
materialBom.setStandardAmount(BigDecimal.valueOf(amountCell.getNumericCellValue())); switch (amountCell.getCellType()) {
case STRING:
materialBom.setStandardAmount(BigDecimal.valueOf(Double.parseDouble(amountCell.getStringCellValue())));
break;
case NUMERIC:
materialBom.setStandardAmount(BigDecimal.valueOf(amountCell.getNumericCellValue()));
break;
default:
throw new ServiceException("Excel数量列的格式错误:请设置成数值格式");
}
materialBom.setErpMaterialId(materialInfo.getErpId()); materialBom.setErpMaterialId(materialInfo.getErpId());
if (brandCell != null) { if (brandCell != null) {
materialBom.setBrand(brandCell.getStringCellValue()); materialBom.setBrand(brandCell.getStringCellValue());
@ -414,7 +426,7 @@ public class MesImportImpl implements IMesImportService {
} finally { } finally {
IOUtils.closeQuietly(is); IOUtils.closeQuietly(is);
} }
return "BOM导入成功"; return "导入成功";
} }
} }

@ -577,6 +577,7 @@ public class MesProductPlanDetailServiceImpl implements IMesProductPlanDetailSer
if (barcodeProductPlan == null) { if (barcodeProductPlan == null) {
throw new ServiceException("无派工信息"); throw new ServiceException("无派工信息");
} }
//根据派工单号dispatchcode和五楼组装工序processid获取生产计划
MesProductPlan queryProductPlan = new MesProductPlan(); MesProductPlan queryProductPlan = new MesProductPlan();
queryProductPlan.setDispatchCode(barcodeProductPlan.getDispatchCode()); queryProductPlan.setDispatchCode(barcodeProductPlan.getDispatchCode());
queryProductPlan.setProcessId(mesConfig.getPdaAssembleProcessId()); queryProductPlan.setProcessId(mesConfig.getPdaAssembleProcessId());

@ -6,7 +6,10 @@ import java.util.Date;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.hw.common.core.constant.Constants;
import com.hw.common.core.constant.MesConstants; import com.hw.common.core.constant.MesConstants;
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.exception.ServiceException;
import com.hw.common.core.utils.DateUtils; import com.hw.common.core.utils.DateUtils;
import com.hw.common.core.utils.StringUtils; import com.hw.common.core.utils.StringUtils;
@ -15,12 +18,16 @@ import com.hw.mes.api.domain.MesBaseMaterialInfo;
import com.hw.mes.api.domain.MesOrderBind; import com.hw.mes.api.domain.MesOrderBind;
import com.hw.mes.domain.MesSaleOrder; import com.hw.mes.domain.MesSaleOrder;
import com.hw.mes.mapper.*; import com.hw.mes.mapper.*;
import com.hw.wms.api.RemoteWmsService;
import com.hw.wms.api.domain.vo.WmsAutoOutstockVo;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.hw.mes.domain.MesPurchaseOrder; import com.hw.mes.domain.MesPurchaseOrder;
import com.hw.mes.service.IMesPurchaseOrderService; import com.hw.mes.service.IMesPurchaseOrderService;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
/** /**
* Service * Service
* *
@ -44,6 +51,9 @@ public class MesPurchaseOrderServiceImpl implements IMesPurchaseOrderService {
@Autowired @Autowired
private MesOrderBindMapper mesOrderBindMapper; private MesOrderBindMapper mesOrderBindMapper;
@Resource
private RemoteWmsService remoteWmsService;
/** /**
* *
* *
@ -425,7 +435,6 @@ public class MesPurchaseOrderServiceImpl implements IMesPurchaseOrderService {
} }
/** /**
* join order bind * join order bind
* *
@ -440,4 +449,64 @@ public class MesPurchaseOrderServiceImpl implements IMesPurchaseOrderService {
? mesPurchaseOrder.getProductSpec().replaceAll("\\s+", "") : ""); ? mesPurchaseOrder.getProductSpec().replaceAll("\\s+", "") : "");
return mesPurchaseOrderMapper.selectPurchaseOrderJoinList(mesPurchaseOrder); return mesPurchaseOrderMapper.selectPurchaseOrderJoinList(mesPurchaseOrder);
} }
/**
* raw_instock(group by)
*
* @param dateStr
* @return List<MesPurchaseOrder>
*/
@Override
@Transactional(rollbackFor = Exception.class)
public int autoOutstockLastPurchaseOrders(String dateStr) {
if (StringUtils.isEmpty(dateStr)) {
dateStr = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, new Date());
}
List<MesPurchaseOrder> mesPurchaseOrderList = mesPurchaseOrderMapper.selectNotRawInstockPurchaseOrderList(dateStr);
List<MesPurchaseOrder> autoStockPurchaseOrderList = new ArrayList<>();
if (mesPurchaseOrderList != null && !mesPurchaseOrderList.isEmpty()) {
//判断物料信息是否自动出库
for (MesPurchaseOrder mesPurchaseOrder : mesPurchaseOrderList) {
MesBaseMaterialInfo mesBaseMaterialInfo = mesBaseMaterialInfoMapper.selectMesBaseMaterialInfoByErpId(mesPurchaseOrder.getMaterialId());
if (StringUtils.isNotEmpty(mesBaseMaterialInfo.getAutoOutstockFlag()) &&
mesBaseMaterialInfo.getAutoOutstockFlag().equals(MesConstants.MES_MATERIAL_AUTO_OUTSTOCK_FLAG_YES)) {
autoStockPurchaseOrderList.add(mesPurchaseOrder);
}
}
}
if (!autoStockPurchaseOrderList.isEmpty()) {
for(MesPurchaseOrder mpo : autoStockPurchaseOrderList){
MesBaseMaterialInfo mesBaseMaterialInfo = mesBaseMaterialInfoMapper.selectMesBaseMaterialInfoByErpId(mpo.getMaterialId());
mpo.setOrderStatus(MesConstants.MES_PURCHASE_ORDER_STATUS_AUTO_OUTSTOCK_COMPLETE);
mpo.setUpdateBy("autoOutstock");
mpo.setUpdateTime(new Date());
mesPurchaseOrderMapper.updateMesPurchaseOrder(mpo);
WmsAutoOutstockVo wmsAutoOutstockVo = new WmsAutoOutstockVo();
wmsAutoOutstockVo.setMaterialId(mesBaseMaterialInfo.getMaterialId());
wmsAutoOutstockVo.setPoNo(mpo.getPoNo());
R<?> autoOutstockReturnMsg = remoteWmsService.autoOutstock(wmsAutoOutstockVo, SecurityConstants.INNER);
if (autoOutstockReturnMsg.getCode() != Constants.SUCCESS) {//抛出异常,回滚事务
throw new RuntimeException(autoOutstockReturnMsg.getMsg());
}
}
}
/*select * from wms_raw_instock wri where date_format(apply_date,'%y%m%d') = date_format('2024-6-21','%y%m%d')
and exists (select 1 from mes_base_material_info mbmi where wri.material_id=mbmi.material_id and mbmi.auto_outstock_flag='1');
select * from mes_purchase_order mpo where not exists (select 1 from wms_raw_instock wri where
date_format(wri.apply_date,'%y%m%d') = date_format('2024-6-21','%y%m%d') and mpo.material_id = wri.material_id)
and mpo.order_status ='3' and mpo.auto_outstock_flag ='0' group_by mpo.po_no;
--
select * from wms_raw_stock wrs where wrs.material_id=?
and exists (select 1 from mes_base_barcode_info mbbi where wrs.instock_batch = mbbi.barcode_info and mbbi.po_no=? )*/
return 1;
}
} }

@ -358,7 +358,8 @@
bmi.use_org_id, bmi.use_org_id,
bmi.prodline_id, bmi.prodline_id,
bmi.approve_date, bmi.approve_date,
bmi.erp_modify_date bmi.erp_modify_date,
bmi.auto_outstock_flag
from mes_base_material_info bmi from mes_base_material_info bmi
where bmi.erp_id = #{erpId} limit 1 where bmi.erp_id = #{erpId} limit 1
</select> </select>

@ -157,7 +157,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="productCode != null and productCode != ''"> and pbmi.product_code like concat('%', #{productCode}, '%')</if> <if test="productCode != null and productCode != ''"> and pbmi.product_code like concat('%', #{productCode}, '%')</if>
<if test="productName != null and productName != ''"> and pbmi.product_name like concat('%', #{productName}, '%')</if> <if test="productName != null and productName != ''"> and pbmi.product_name like concat('%', #{productName}, '%')</if>
<if test="poNo != null and poNo != ''"> and mob.po_no like concat('%', #{poNo}, '%')</if> <if test="poNo != null and poNo != ''"> and mob.po_no like concat('%', #{poNo}, '%')</if>
<if test="materialCode != null and materialCode != ''"> and mbmi.material_code = like concat('%', #{materialCode}, '%')</if> <if test="materialCode != null and materialCode != ''"> and mbmi.material_code like concat('%', #{materialCode}, '%')</if>
<if test="materialName != null and materialName != ''"> and mbmi.material_name like concat('%', #{materialName}, '%')</if> <if test="materialName != null and materialName != ''"> and mbmi.material_name like concat('%', #{materialName}, '%')</if>
<if test="materialSpec != null and materialSpec != ''">and replace(mbmi.material_spec,' ','') like concat('%', #{materialSpec}, <if test="materialSpec != null and materialSpec != ''">and replace(mbmi.material_spec,' ','') like concat('%', #{materialSpec},
'%')</if> '%')</if>

@ -463,7 +463,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="productCode != null and productCode != ''"> and pbmi.material_code like concat('%', #{productCode}, '%')</if> <if test="productCode != null and productCode != ''"> and pbmi.material_code like concat('%', #{productCode}, '%')</if>
<if test="productName != null and productName != ''"> and pbmi.material_name like concat('%', #{productName}, '%')</if> <if test="productName != null and productName != ''"> and pbmi.material_name like concat('%', #{productName}, '%')</if>
<if test="poNo != null and poNo != ''"> and mpo.po_no like concat('%', #{poNo}, '%')</if> <if test="poNo != null and poNo != ''"> and mpo.po_no like concat('%', #{poNo}, '%')</if>
<if test="materialCode != null and materialCode != ''"> and mbmi.material_code = like concat('%', #{materialCode}, '%')</if> <if test="materialCode != null and materialCode != ''"> and mbmi.material_code like concat('%', #{materialCode}, '%')</if>
<if test="materialName != null and materialName != ''"> and mbmi.material_name like concat('%', #{materialName}, '%')</if> <if test="materialName != null and materialName != ''"> and mbmi.material_name like concat('%', #{materialName}, '%')</if>
<if test="materialSpec != null and materialSpec != ''">and replace(mbmi.material_spec,' ','') like concat('%', #{materialSpec}, <if test="materialSpec != null and materialSpec != ''">and replace(mbmi.material_spec,' ','') like concat('%', #{materialSpec},
'%')</if> '%')</if>
@ -473,4 +473,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
order by mpo.po_no order by mpo.po_no
</select> </select>
<select id="selectNotRawInstockPurchaseOrderList" parameterType="String" resultMap="MesPurchaseOrderResult">
select mpo.purchase_order_id,mpo.po_no,mpo.material_id from mes_purchase_order mpo where exists (select 1 from wms_raw_instock wri where
date_format(wri.apply_date, '%y%m%d') = date_format(#{applyDateStr},'%y%m%d') and
mpo.material_id = (select mbmi.erp_id from mes_base_material_info mbmi where mbmi.material_id=wri.material_id) and mpo.po_no!=wri.po_no)
and mpo.order_status ='3' group by mpo.purchase_order_id,mpo.po_no,mpo.material_id
</select>
</mapper> </mapper>

@ -4,7 +4,9 @@ import java.util.List;
import java.io.IOException; import java.io.IOException;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.hw.common.core.domain.R;
import com.hw.common.security.annotation.InnerAuth; import com.hw.common.security.annotation.InnerAuth;
import com.hw.wms.api.domain.vo.WmsAutoOutstockVo;
import com.hw.wms.api.domain.vo.WmsRawStockVo; import com.hw.wms.api.domain.vo.WmsRawStockVo;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
@ -124,4 +126,15 @@ public class WmsRawStockController extends BaseController
return success(exists); return success(exists);
} }
/**
*
*/
@InnerAuth
@PostMapping(value = "/autoOutstock")
public R<?> autoOutstock(@RequestBody WmsAutoOutstockVo wmsAutoOutstockVo)
{
return R.ok(wmsRawStockService.autoOutstock(wmsAutoOutstockVo));
}
} }

@ -114,7 +114,7 @@ public class WmsRawOutstock extends BaseEntity {
/** /**
* (1,2,3,9) * (1,2,3,9)
*/ */
@Excel(name = "任务类型(1生产领料,2移库出库,3合库出库,9其他领料)") @Excel(name = "任务类型(1生产领料,2移库出库,3合库出库,4自动出库9其他领料)")
private String taskType; private String taskType;
private String splitFlag; private String splitFlag;

@ -118,4 +118,13 @@ public interface WmsRawStockMapper {
public List<WmsRawStock> selectWmsRawStocks4Transfer(WmsRawStock wmsRawStock); public List<WmsRawStock> selectWmsRawStocks4Transfer(WmsRawStock wmsRawStock);
/**
*
*
* @param materialId ID
* @param poNo
* @return
*/
public List<WmsRawStock> selectAutoOutstockRawStockList(@Param("materialId") Long materialId, @Param("poNo") String poNo);
} }

@ -1,7 +1,10 @@
package com.hw.wms.service; package com.hw.wms.service;
import java.util.List; import java.util.List;
import com.hw.wms.api.domain.vo.WmsAutoOutstockVo;
import com.hw.wms.domain.WmsRawStock; import com.hw.wms.domain.WmsRawStock;
import org.springframework.transaction.annotation.Transactional;
/** /**
* Service * Service
@ -81,4 +84,12 @@ public interface IWmsRawStockService
* @return * @return
*/ */
public boolean checkRawStock(WmsRawStock wmsRawStock); public boolean checkRawStock(WmsRawStock wmsRawStock);
/**
*
* @param wmsAutoOutstockVo
*/
public int autoOutstock(WmsAutoOutstockVo wmsAutoOutstockVo);
} }

@ -1,14 +1,21 @@
package com.hw.wms.service.impl; package com.hw.wms.service.impl;
import java.util.Date;
import java.util.List; import java.util.List;
import com.hw.common.core.constant.WmsConstants; import com.hw.common.core.constant.WmsConstants;
import com.hw.common.core.utils.StringUtils; 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.wms.api.domain.vo.WmsAutoOutstockVo;
import com.hw.wms.domain.WmsRawOutstock;
import com.hw.wms.mapper.WmsRawOutstockMapper;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.hw.wms.mapper.WmsRawStockMapper; import com.hw.wms.mapper.WmsRawStockMapper;
import com.hw.wms.domain.WmsRawStock; import com.hw.wms.domain.WmsRawStock;
import com.hw.wms.service.IWmsRawStockService; import com.hw.wms.service.IWmsRawStockService;
import org.springframework.transaction.annotation.Transactional;
/** /**
* Service * Service
@ -21,6 +28,10 @@ public class WmsRawStockServiceImpl implements IWmsRawStockService {
@Autowired @Autowired
private WmsRawStockMapper wmsRawStockMapper; private WmsRawStockMapper wmsRawStockMapper;
@Autowired
private WmsRawOutstockMapper wmsRawOutstockMapper;
/** /**
* *
* *
@ -132,4 +143,47 @@ public class WmsRawStockServiceImpl implements IWmsRawStockService {
List<WmsRawStock> wmsRawStocks = wmsRawStockMapper.selectWmsRawStockList(wmsRawStock); List<WmsRawStock> wmsRawStocks = wmsRawStockMapper.selectWmsRawStockList(wmsRawStock);
return wmsRawStocks != null && !wmsRawStocks.isEmpty(); return wmsRawStocks != null && !wmsRawStocks.isEmpty();
} }
/**
*
*
* @param wmsAutoOutstockVo
*/
@Override
@Transactional(rollbackFor = Exception.class)
public int autoOutstock(WmsAutoOutstockVo wmsAutoOutstockVo) {
List<WmsRawStock> wmsRawStocks = wmsRawStockMapper.selectAutoOutstockRawStockList(wmsAutoOutstockVo.getMaterialId(), wmsAutoOutstockVo.getPoNo());
Date currentDate = new Date();
for (WmsRawStock wmsRawStock : wmsRawStocks) {
wmsRawStockMapper.deleteWmsRawStockByRawStockId(wmsRawStock.getRawStockId());
WmsRawOutstock wmsRawOutstock = new WmsRawOutstock();
wmsRawOutstock.setTaskCode(Seq.getId(Seq.rawOutstockSeqType, Seq.rawOutstockSeqCode));
wmsRawOutstock.setWarehouseId(wmsRawStock.getWarehouseId());
wmsRawOutstock.setLocationCode(wmsRawStock.getLocationCode());
wmsRawOutstock.setSaleOrderId(wmsRawStock.getSaleOrderId());
wmsRawOutstock.setMaterialId(wmsRawStock.getMaterialId());
wmsRawOutstock.setMaterialBatch(wmsRawStock.getInstockBatch());
wmsRawOutstock.setOutstockAmount(wmsRawStock.getTotalAmount());
wmsRawOutstock.setRealOutstockAmount(wmsRawStock.getTotalAmount());
wmsRawOutstock.setOperationType(WmsConstants.WMS_OPERATION_TYPE_MANUAL);
wmsRawOutstock.setTaskType(WmsConstants.WMS_RAW_OUTSTOCK_TASK_TYPE_AUTO_OUTSTOCK);
wmsRawOutstock.setAuditStatus(WmsConstants.WMS_AUDIT_STATUS_PASS);
wmsRawOutstock.setExecuteStatus(WmsConstants.WMS_EXECUTE_STATUS_FINISH);
wmsRawOutstock.setApplyBy("autoOutstock");
wmsRawOutstock.setApplyDate(currentDate);
wmsRawOutstock.setUpdateDate(currentDate);
wmsRawOutstock.setUpdateBy("autoOutstock");
wmsRawOutstock.setBeginTime(currentDate);
wmsRawOutstock.setEndTime(currentDate);
wmsRawOutstockMapper.insertWmsRawOutstock(wmsRawOutstock);
}
return 1;
}
} }

@ -366,4 +366,11 @@
order by wbl.loc_column asc, wbl.loc_deep desc limit #{params.limit} order by wbl.loc_column asc, wbl.loc_deep desc limit #{params.limit}
</select> </select>
<select id="selectAutoOutstockRawStockList" parameterType="WmsRawStock" resultMap="WmsRawStockResult">
select wrs.raw_stock_id,wrs.warehouse_id,wrs.sale_order_id,wrs.material_id,wrs.instock_batch,wrs.total_amount from wms_raw_stock wrs where wrs.material_id=#{materialId}
and exists (select 1 from mes_base_barcode_info mbbi where wrs.instock_batch = mbbi.barcode_info and mbbi.po_no=#{poNo} )
</select>
</mapper> </mapper>

@ -202,7 +202,7 @@
> >
</el-table-column> </el-table-column>
<el-table-column <el-table-column
label="计划技术时间" label="计划结束时间"
prop="planEndTime" prop="planEndTime"
width="150" width="150"
> >
@ -1374,12 +1374,19 @@ export default {
message: '已完成', message: '已完成',
type: 'success' type: 'success'
}); });
this.form.planDetailStatus = setState("3");
let productPlanRow = this.tableData.find(v => v.planCode === this.form.planCode);
productPlanRow.completeAmount = productPlanRow.completeAmount+1;
} }
getProductPlans({pageNum: this.nowNum1, pageSize: 5}).then(e => {
this.tableData = e.rows
this.totalNum1 = Math.ceil(e.total / 5)
this.tableClick(e.rows.find(v => v.planCode === this.form.planCode)) // getProductPlans({pageNum: this.nowNum1, pageSize: 5}).then(e => {
}) // this.tableData = e.rows
// this.totalNum1 = Math.ceil(e.total / 5)
// this.tableClick(e.rows.find(v => v.planCode === this.form.planCode))
// })
}).catch(() => { }).catch(() => {
}); });
}, },

@ -66,7 +66,7 @@
value-format="yyyy-MM-dd" value-format="yyyy-MM-dd"
placeholder="请选择实际结束时间"> placeholder="请选择实际结束时间">
</el-date-picker> </el-date-picker>
</el-form-item>--> </el-form-item>
<!-- <el-form-item label="执行人员" prop="performer">--> <!-- <el-form-item label="执行人员" prop="performer">-->
<!-- <el-input--> <!-- <el-input-->

@ -111,7 +111,7 @@
<el-table-column v-if="columns[23].visible" align="center" label="备注" prop="remark"/> <el-table-column v-if="columns[23].visible" align="center" label="备注" prop="remark"/>
<el-table-column align="center" class-name="small-padding fixed-width" fixed="right" label="操作"> <el-table-column align="center" class-name="small-padding fixed-width" fixed="right" label="操作">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <!--el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-refresh" icon="el-icon-refresh"
@ -119,7 +119,7 @@
v-if="scope.row.printFlag ==='1'" v-if="scope.row.printFlag ==='1'"
v-hasPermi="['mes:barcode:regenerateProductBarcode']" v-hasPermi="['mes:barcode:regenerateProductBarcode']"
>重新生成 >重新生成
</el-button> </el-button-->
<el-button <el-button
size="mini" size="mini"
type="text" type="text"

@ -235,7 +235,7 @@
>编辑 >编辑
</el-button> </el-button>
<el-button <!--el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-refresh" icon="el-icon-refresh"
@ -243,7 +243,7 @@
v-if="scope.row.printFlag ==='1'" v-if="scope.row.printFlag ==='1'"
v-hasPermi="['mes:barcode:regenerate']" v-hasPermi="['mes:barcode:regenerate']"
>重新生成 >重新生成
</el-button> </el-button-->
<el-button <el-button
size="mini" size="mini"
type="text" type="text"

@ -108,7 +108,7 @@
<el-table-column label="父级标识" prop="parentId" v-if="columns[1].visible"/> <el-table-column label="父级标识" prop="parentId" v-if="columns[1].visible"/>
<el-table-column label="祖级列表" align="center" prop="ancestors" v-if="columns[2].visible"/> <el-table-column label="祖级列表" align="center" prop="ancestors" v-if="columns[2].visible"/>
<el-table-column label="物料ID" align="center" prop="materialId" v-if="columns[3].visible"/> <el-table-column label="物料ID" align="center" prop="materialId" v-if="columns[3].visible"/>
<el-table-column label="物料编码" align="center" prop="materialCode"/> <el-table-column label="物料编码" align="left" prop="materialCode" />
<el-table-column label="物料名称" align="left" prop="materialName" v-if="columns[4].visible"/> <el-table-column label="物料名称" align="left" prop="materialName" v-if="columns[4].visible"/>
<el-table-column label="物料规格" align="center" prop="materialSpec"/> <el-table-column label="物料规格" align="center" prop="materialSpec"/>
<el-table-column label="BOM说明" align="center" prop="materialBomDesc" v-if="columns[15].visible"/> <el-table-column label="BOM说明" align="center" prop="materialBomDesc" v-if="columns[15].visible"/>

@ -89,7 +89,7 @@
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item label="人工处理标识" prop="manualFlag" label-width="98px"> <!--el-form-item label="人工处理标识" prop="manualFlag" label-width="98px">
<el-select <el-select
v-model="queryParams.manualFlag" v-model="queryParams.manualFlag"
placeholder="请选择人工处理标识" placeholder="请选择人工处理标识"
@ -103,7 +103,7 @@
:value="dict.value" :value="dict.value"
/> />
</el-select> </el-select>
</el-form-item> </el-form-item-->
<!--el-form-item label="入库过度标识" prop="instockFlag" label-width="98px"> <!--el-form-item label="入库过度标识" prop="instockFlag" label-width="98px">
<el-select <el-select
@ -263,11 +263,11 @@
<dict-tag :options="dict.type.wms_loc_deep" :value="scope.row.locDeep"/> <dict-tag :options="dict.type.wms_loc_deep" :value="scope.row.locDeep"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="人工处理标识" align="center" prop="manualFlag"> <!--el-table-column label="人工处理标识" align="center" prop="manualFlag">
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag :options="dict.type.wms_location_manual_flag" :value="scope.row.manualFlag"/> <dict-tag :options="dict.type.wms_location_manual_flag" :value="scope.row.manualFlag"/>
</template> </template>
</el-table-column> </el-table-column-->
<!-- <el-table-column label="入库过度标识" align="center" prop="instockFlag">--> <!-- <el-table-column label="入库过度标识" align="center" prop="instockFlag">-->
<!-- <template slot-scope="scope">--> <!-- <template slot-scope="scope">-->
<!-- <dict-tag :options="dict.type.wms_location_instock_flag" :value="scope.row.manualFlag"/>--> <!-- <dict-tag :options="dict.type.wms_location_instock_flag" :value="scope.row.manualFlag"/>-->
@ -365,7 +365,7 @@
</el-form-item> </el-form-item>
<el-row> <!--el-row>
<el-col :span="12"> <el-col :span="12">
<el-form-item label="库位编号" prop="locationCode"> <el-form-item label="库位编号" prop="locationCode">
<el-input v-model="form.locationCode" placeholder="请输入库位编号"/> <el-input v-model="form.locationCode" placeholder="请输入库位编号"/>
@ -381,8 +381,10 @@
</el-radio> </el-radio>
</el-radio-group> </el-radio-group>
</el-form-item> </el-form-item>
</el-row> </el-row-->
<el-form-item label="库位编号" prop="locationCode">
<el-input v-model="form.locationCode" placeholder="请输入库位编号" style="width:300px;"/>
</el-form-item>
<el-row> <el-row>
<el-col :span="7"> <el-col :span="7">

Loading…
Cancel
Save