Merge remote-tracking branch 'origin/master'

master
夜笙歌 1 year ago
commit 930648c0d5

@ -20,6 +20,11 @@ import org.springframework.web.bind.annotation.RequestHeader;
@FeignClient(contextId = "remoteJindieService", value = ServiceNameConstants.JINDIE_SERVICE, fallbackFactory = RemoteJindieFallbackFactory.class)
public interface RemoteJindieService {
/** 同步单位信息*/
@PostMapping("/jindie/syncUnitInfoFromErp")
R<Integer> syncUnitInfoFromErp(@RequestBody ErpSyncInfoVo erpSyncInfoVo,@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
/** 同步供应商*/
@PostMapping("/jindie/syncSupplierInfoFromErp")
R<Integer> syncSupplierInfoFromErp(@RequestBody ErpSyncInfoVo erpSyncInfoVo,@RequestHeader(SecurityConstants.FROM_SOURCE) String source);

@ -16,6 +16,11 @@ import org.springframework.web.bind.annotation.RequestBody;
public class RemoteJindieFallbackFactory implements FallbackFactory<RemoteJindieService> {
public RemoteJindieService create(Throwable throwable) {
return new RemoteJindieService() {
@Override
public R<Integer> syncUnitInfoFromErp(ErpSyncInfoVo erpSyncInfoVo, String source) {
return R.fail("同步单位信息失败:" + throwable.getMessage());
}
@Override
public R<Integer> syncSupplierInfoFromErp(ErpSyncInfoVo erpSyncInfoVo,String source) {
return R.fail("同步供应商信息失败:" + throwable.getMessage());

@ -103,7 +103,7 @@ public interface RemoteMesService {
public R<?> start5thFloorInstall(@RequestBody MesPdaProductPlanVo mesPdaProductPlanVo, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
/**
* 5
* 5
*
* @param mesPdaProductPlanVo
* @param source
@ -132,7 +132,7 @@ public interface RemoteMesService {
* @return
*/
@PostMapping("/saleOrder/transferSaleOrders")
public R<Boolean> transferSaleOrders(@RequestBody MesSaleOrderTransferVo mesSaleOrderTransferVo, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
public R<?> transferSaleOrders(@RequestBody MesSaleOrderTransferVo mesSaleOrderTransferVo,@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
/**
@ -192,4 +192,24 @@ public interface RemoteMesService {
/**
*
*
* @param saleOrderId ID
* @param source
* @return
*/
@GetMapping("/saleOrder/getRelateProductsBySaleOrderId/{saleOrderId}")
public R<List<MesSaleOrderRelate>> getRelateProductsBySaleOrderId(@PathVariable("saleOrderId") Long saleOrderId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
/**
*
*
* @param saleOrderId ID
* @param source
* @return
*/
@GetMapping("/saleOrder/getRelateMaterialsBySaleOrderId/{saleOrderId}")
public R<List<MesSaleOrderRelate>> getRelateMaterialsBySaleOrderId(@PathVariable("saleOrderId") Long saleOrderId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
}

@ -0,0 +1,35 @@
package com.hw.mes.api.domain.vo;
import com.hw.mes.api.domain.MesBaseBarcodeInfo;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
/**
* @Description: VO
* @ClassName: MesSaleOrderTransferVo
* @Author : xins
* @Date :2024-09-04 14:21
* @Version :1.0
*/
@Data
public class MesBaseBarcodeInfoTransferVo {
//新的销售订单ID
@NotNull(message = "销售订单Id必须输入")
private Long saleOrderId;
//新的销售订单号
@NotEmpty(message = "销售订单号必须输入")
private String saleOrderCode;
//安全库存标识
@NotEmpty(message = "安全库存标识必须输入")
private String safeFlag;
//条码内容
@NotEmpty(message = "条码内容必须输入")
private String barcodeInfo;
}

@ -17,12 +17,12 @@ import java.util.List;
@Data
public class MesSaleOrderTransferVo {
//转换的条码信息
// 转换的条码信息
@NotNull(message = "条码信息不能为空")
private List<MesBaseBarcodeInfo> mesBaseBarcodeInfos;
private List<MesBaseBarcodeInfoTransferVo> mesBaseBarcodeInfoTransferVos;
//转换数量
@NotNull(message = "转换不能为空")
@NotNull(message = "转换数量不能为空")
private BigDecimal transferAmount;
//老的销售订单ID

@ -77,7 +77,7 @@ public class RemoteMesFallbackFactory implements FallbackFactory<RemoteMesServic
}
@Override
public R<Boolean> transferSaleOrders(MesSaleOrderTransferVo mesSaleOrderTransferVo, String source) {
public R<?> transferSaleOrders(MesSaleOrderTransferVo mesSaleOrderTransferVo,String source) {
return R.fail("销售订单信息转换失败:" + throwable.getMessage());
}
@ -105,6 +105,17 @@ public class RemoteMesFallbackFactory implements FallbackFactory<RemoteMesServic
public R<MesBaseBarcodeInfo> autoOutstockLastPurchaseOrders(String dateStr, String source) {
return R.fail("自动出库之前采购订单的物料信息失败:" + throwable.getMessage());
}
@Override
public R<List<MesSaleOrderRelate>> getRelateProductsBySaleOrderId(Long saleOrderId, String source) {
return R.fail("根据销售订单ID获取关联成品信息失败:" + throwable.getMessage());
}
@Override
public R<List<MesSaleOrderRelate>> getRelateMaterialsBySaleOrderId(Long saleOrderId, String source) {
return R.fail("根据销售订单ID获取关联原材料信息失败:" + throwable.getMessage());
}
};
}
}

@ -21,9 +21,16 @@ public class PrintContentVo {
public static final String RAW_MATERIAL_LABEL_KEY_QC_RESULT_YES = "qcResultYes";
public static final String RAW_MATERIAL_LABEL_KEY_QC_RESULT_NO = "qcResultNo";
public static final String RAW_MATERIAL_LABEL_KEY_QRCODE = "qrcode";
public static final String RAW_MATERIAL_LABEL_KEY_BARCODE = "barcode";
public static final String PRODUCT_PLAN_CODE = "productPlanCode";
public static final String PRINT_TEMPLATE_RAW = "raw";
public static final String PRINT_TEMPLATE_PRODUCT = "product";
public static final String PRINT_TEMPLATE_BIND = "bind";
private String key;
private String value;

@ -8,6 +8,7 @@ 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.WmsRawStockVo;
import com.hw.wms.api.domain.vo.WmsWarehouseMaterialExistVo;
import com.hw.wms.api.factory.RemoteWmsFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
@ -15,7 +16,6 @@ import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;
@FeignClient(contextId = "remoteWmsService", value = ServiceNameConstants.WMS_SERVICE, fallbackFactory = RemoteWmsFallbackFactory.class)
@ -75,4 +75,8 @@ public interface RemoteWmsService {
@PostMapping("/rawstock/autoOutstock")
public R<?> autoOutstock(@Validated @RequestBody WmsAutoOutstockVo wmsAutoOutstockVo, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
@PostMapping("/wmswarehouse/isExistWarehouseMaterial")
public R<Boolean> isExistWarehouseMaterial(@Validated @RequestBody WmsWarehouseMaterial wmsWarehouseMaterial, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
}

@ -0,0 +1,11 @@
package com.hw.wms.api.domain.vo;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
@Data
public class WmsWarehouseMaterialExistVo {
@NotEmpty(message="物料ID不能为空")
private Long materialId;
}

@ -7,6 +7,7 @@ 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.WmsRawStockVo;
import com.hw.wms.api.domain.vo.WmsWarehouseMaterialExistVo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
@ -71,6 +72,11 @@ public class RemoteWmsFallbackFactory implements FallbackFactory<RemoteWmsServic
return R.fail("自动出库失败:" + throwable.getMessage());
}
@Override
public R<Boolean> isExistWarehouseMaterial(WmsWarehouseMaterial wmsWarehouseMaterial, String source) {
return R.fail("获取是否绑定仓库信息失败:" + throwable.getMessage());
}
};
}
}

@ -153,6 +153,8 @@ public class WmsConstants {
public static final String WMS_BASE_LOCATION_STATUS_MOVE_LOCK = "4";//移库锁定
public static final String WMS_BASE_LOCATION_STATUS_MERGE_LOCK = "5";//合库锁定
public static final String WMS_BASE_LOCATION_STATUS_OUT_STOCK = "6";//出库锁定
public static final String WMS_BASE_LOCATION_STATUS_RETURN_LOCK = "7";//退货锁定
public static final String WMS_BASE_LOCATION_STATUS_DEEP_ABNORMAL = "8";//深库位异常
public static final String WMS_BASE_LOCATION_STATUS_ABNORMAL = "9";//异常
@ -193,6 +195,7 @@ public class WmsConstants {
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_RETURN_OUTSTOCK = "5";//退货出库
public static final String WMS_RAW_OUTSTOCK_TASK_TYPE_OTHER = "9";//其他
@ -266,4 +269,17 @@ public class WmsConstants {
public static final String WMS_SAFE_FLAG_YES = "1";//安全库存,是
public static final String WMS_SAFE_FLAG_NO = "0";//安全库存,否
/**
*
*/
public static final Long WMS_BASE_LOCATION_LOC_DEEP_BACK = 1L;//深库位
public static final Long WMS_BASE_LOCATION_LOC_DEEP_FRONT = 2L;//浅库位
/**
*
*/
public static final String WMS_INVENTORY_CHECK_TYPE_MANUAL = "1";//人工
public static final String WMS_INVENTORY_CHECK_TYPE_WCS = "2";//WCS调度
public static final String WMS_INVENTORY_CHECK_TYPE_CTU = "3";//CTU
}

@ -79,6 +79,14 @@ public class RyTask
System.out.println("++创建保养工单++getDmsMaintInstance");
remoteDmsService.getDmsBillsMaintInstance(SecurityConstants.INNER,planMaintCode);
}
public void syncUnitInfoFromErp(String maxErpModifyDate){
ErpSyncInfoVo erpSyncInfoVo = new ErpSyncInfoVo();
erpSyncInfoVo.setMaxErpModifyDate(maxErpModifyDate);
System.out.println("++同步ERP中物料供应商++ErpSupplierInfo");
remoteJindieService.syncUnitInfoFromErp(erpSyncInfoVo,SecurityConstants.INNER);
}
public void syncSupplierInfoFromErp(String maxErpModifyDate){
ErpSyncInfoVo erpSyncInfoVo = new ErpSyncInfoVo();
erpSyncInfoVo.setMaxErpModifyDate(maxErpModifyDate);

@ -314,6 +314,17 @@ public class MesApiController extends BaseController {
}
/**
*
* @param barcodeIds
* @return
*/
@GetMapping(value = "/reprintBarcodes/{barcodeIds}")
public AjaxResult reprintBarcodes(@PathVariable Long[] barcodeIds)
{
return success(mesBaseBarcodeInfoService.printBarcodes(barcodeIds,MesConstants.MES_BARCODE_TYPE_PRODUCT,true,1));
}
/**
*
*

@ -212,7 +212,7 @@ public class MesBaseBarcodeInfoController extends BaseController
/**
*
* ()
* @param barcodeIds
* @return
*/

@ -6,6 +6,8 @@ import javax.servlet.http.HttpServletResponse;
import com.hw.common.security.annotation.InnerAuth;
import com.hw.mes.api.domain.vo.MesBaseMaterialInfoVo;
import com.hw.mes.domain.MesBaseMaterialType;
import com.hw.mes.service.IMesBaseMaterialTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
@ -37,6 +39,9 @@ public class MesBaseMaterialInfoController extends BaseController
{
@Autowired
private IMesBaseMaterialInfoService mesBaseMaterialInfoService;
@Autowired
private IMesBaseMaterialTypeService mesBaseMaterialTypeService;
/**
*
@ -157,4 +162,15 @@ public class MesBaseMaterialInfoController extends BaseController
return getDataTable(list);
}
/**
*
*/
@RequiresPermissions("mes:materialinfo:list")
@GetMapping("/getMaterialTypes")
public AjaxResult getMaterialTypes(MesBaseMaterialType mesBaseMaterialType)
{
List<MesBaseMaterialType> list = mesBaseMaterialTypeService.selectMesBaseMaterialTypeList(mesBaseMaterialType);
return success(list);
}
}

@ -2,14 +2,19 @@ package com.hw.mes.controller;
import com.hw.common.core.web.controller.BaseController;
import com.hw.common.core.web.domain.AjaxResult;
import com.hw.common.core.web.page.TableDataInfo;
import com.hw.common.log.annotation.Log;
import com.hw.common.log.enums.BusinessType;
import com.hw.common.security.annotation.RequiresPermissions;
import com.hw.mes.domain.MesBasePalletInfo;
import com.hw.mes.domain.vo.*;
import com.hw.mes.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* MESController
*
@ -33,4 +38,13 @@ public class MesMobileController extends BaseController {
}
/**
*
*/
@GetMapping("/getMesPalletInfos")
public TableDataInfo getMesPalletInfos(MesBasePalletInfo mesBasePalletInfo) {
startPage();
List<MesBasePalletInfo> list = mesBasePalletInfoService.selectMesBasePalletInfoList(mesBasePalletInfo);
return getDataTable(list);
}
}

@ -5,6 +5,8 @@ import javax.servlet.http.HttpServletResponse;
import com.hw.common.core.domain.R;
import com.hw.common.security.annotation.InnerAuth;
import com.hw.mes.api.domain.MesBaseBarcodeInfo;
import com.hw.mes.api.domain.MesSaleOrderRelate;
import com.hw.mes.api.domain.vo.MesSaleOrderTransferVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@ -27,14 +29,13 @@ import com.hw.common.core.web.page.TableDataInfo;
/**
* Controller
*
*
* @author Yinq
* @date 2024-02-19
*/
@RestController
@RequestMapping("/saleOrder")
public class MesSaleOrderController extends BaseController
{
public class MesSaleOrderController extends BaseController {
@Autowired
private IMesSaleOrderService mesSaleOrderService;
@ -44,8 +45,7 @@ public class MesSaleOrderController extends BaseController
*/
@RequiresPermissions("mes:saleOrder:list")
@GetMapping("/list")
public TableDataInfo list(MesSaleOrder mesSaleOrder)
{
public TableDataInfo list(MesSaleOrder mesSaleOrder) {
startPage();
List<MesSaleOrder> list = mesSaleOrderService.selectMesSaleOrderJoinMaterialList(mesSaleOrder);
return getDataTable(list);
@ -57,8 +57,7 @@ public class MesSaleOrderController extends BaseController
@RequiresPermissions("mes:saleOrder:export")
@Log(title = "销售订单信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, MesSaleOrder mesSaleOrder)
{
public void export(HttpServletResponse response, MesSaleOrder mesSaleOrder) {
List<MesSaleOrder> list = mesSaleOrderService.selectMesSaleOrderList(mesSaleOrder);
ExcelUtil<MesSaleOrder> util = new ExcelUtil<MesSaleOrder>(MesSaleOrder.class);
util.exportExcel(response, list, "销售订单信息数据");
@ -69,8 +68,7 @@ public class MesSaleOrderController extends BaseController
*/
@RequiresPermissions("mes:saleOrder:query")
@GetMapping(value = "/{saleOrderId}")
public AjaxResult getInfo(@PathVariable("saleOrderId") Long saleOrderId)
{
public AjaxResult getInfo(@PathVariable("saleOrderId") Long saleOrderId) {
return success(mesSaleOrderService.selectMesSaleOrderBySaleOrderId(saleOrderId));
}
@ -80,8 +78,7 @@ public class MesSaleOrderController extends BaseController
@RequiresPermissions("mes:saleOrder:add")
@Log(title = "销售订单信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody MesSaleOrder mesSaleOrder)
{
public AjaxResult add(@RequestBody MesSaleOrder mesSaleOrder) {
return toAjax(mesSaleOrderService.insertMesSaleOrder(mesSaleOrder));
}
@ -91,8 +88,7 @@ public class MesSaleOrderController extends BaseController
@RequiresPermissions("mes:saleOrder:edit")
@Log(title = "销售订单信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody MesSaleOrder mesSaleOrder)
{
public AjaxResult edit(@RequestBody MesSaleOrder mesSaleOrder) {
return toAjax(mesSaleOrderService.updateMesSaleOrder(mesSaleOrder));
}
@ -101,23 +97,34 @@ public class MesSaleOrderController extends BaseController
*/
@RequiresPermissions("mes:saleOrder:remove")
@Log(title = "销售订单信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{saleOrderIds}")
public AjaxResult remove(@PathVariable Long[] saleOrderIds)
{
@DeleteMapping("/{saleOrderIds}")
public AjaxResult remove(@PathVariable Long[] saleOrderIds) {
return toAjax(mesSaleOrderService.deleteMesSaleOrderBySaleOrderIds(saleOrderIds));
}
/**
*
*/
@InnerAuth
@Log(title = "销售订单信息", businessType = BusinessType.TRANSFER)
@PostMapping(value="/transferSaleOrders")
public R<Boolean> transferSaleOrders(@RequestBody MesSaleOrderTransferVo mesSaleOrderTransferVo)
{
return R.ok(mesSaleOrderService.transferSaleOrders(mesSaleOrderTransferVo));
@PostMapping(value = "/transferSaleOrders")
public R<Boolean> transferSaleOrders(@RequestBody MesSaleOrderTransferVo mesSaleOrderTransferVo) {
try {
return R.ok(mesSaleOrderService.transferSaleOrders(mesSaleOrderTransferVo));
} catch (Exception e) {
return R.fail(e.getMessage());
}
}
/**
*
*/
@InnerAuth
@GetMapping(value = "/getRelateProductsBySaleOrderId/{saleOrderId}")
public R<List<MesSaleOrderRelate>> getRelateProductsBySaleOrderId(@PathVariable("saleOrderId") Long saleOrderId) {
List<MesSaleOrderRelate> list = mesSaleOrderService.getRelateProductsBySaleOrderId(saleOrderId);
return R.ok(list);
}
}

@ -85,4 +85,14 @@ public interface MesSaleOrderRelateMapper
* @return
*/
public MesSaleOrderRelate selectMesSaleOrderRelateByBindBarcode(String bindBarcode);
/**
* ,Join product
*
* @param mesSaleOrderRelate
* @return
*/
public List<MesSaleOrderRelate> selectMesSaleOrderRelateJoinProductList(MesSaleOrderRelate mesSaleOrderRelate);
}

@ -2,6 +2,8 @@ package com.hw.mes.service;
import java.util.List;
import com.hw.mes.api.domain.MesBaseBarcodeInfo;
import com.hw.mes.api.domain.MesSaleOrderRelate;
import com.hw.mes.api.domain.vo.MesSaleOrderTransferVo;
import com.hw.mes.domain.MesSaleOrder;
@ -75,4 +77,11 @@ public interface IMesSaleOrderService
* @return
*/
public boolean transferSaleOrders(MesSaleOrderTransferVo mesSaleOrderTransferVo);
/**
* relatesaleorderId
* @param saleOrderId
* @return
*/
public List<MesSaleOrderRelate> getRelateProductsBySaleOrderId(Long saleOrderId);
}

@ -1,10 +1,13 @@
package com.hw.mes.service.impl;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.hw.common.core.constant.*;
import com.hw.common.core.domain.R;
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.ip.IpUtils;
import com.hw.common.core.utils.uuid.Seq;
import com.hw.common.security.utils.SecurityUtils;
import com.hw.mes.api.domain.*;
@ -24,6 +27,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.data.redis.core.StringRedisTemplate;
import javax.annotation.Resource;
import java.math.BigDecimal;
@ -42,8 +46,8 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
@Autowired
private MesBaseBarcodeInfoMapper mesBaseBarcodeInfoMapper;
@Resource
private RemotePrinterService remotePrinterService;
@Autowired
private StringRedisTemplate redisTemplate;
@Autowired
private MesOrderBindMapper mesOrderBindMapper;
@ -166,10 +170,10 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
if (mesBaseMaterialInfo == null) {
throw new ServiceException("物料信息不存在");
}
if (mesBaseMaterialInfo.getAlwaysFlag() == null) {
throw new ServiceException("请先设置此物料信息[物料编码:" + mesBaseBarcodeInfo.getMaterialCode()
+ ",物料名称:" + mesBaseBarcodeInfo.getMaterialName() + "]的常备物料标识");
}
// if (mesBaseMaterialInfo.getAlwaysFlag() == null) {
// throw new ServiceException("请先设置此物料信息[物料编码:" + mesBaseBarcodeInfo.getMaterialCode()
// + ",物料名称:" + mesBaseBarcodeInfo.getMaterialName() + "]的常备物料标识");
// }
//判断选择的采购订单信息,是否已经合并过
MesSaleOrderRelate querySaleOrderRelate = new MesSaleOrderRelate();
@ -180,11 +184,11 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
}
//如果物料信息为非常备物料,则判断是否有绑定的信息
//不管物料是否常备物料,都判断是否有绑定的信息
BigDecimal barcodeAmount = mesBaseBarcodeInfo.getBarcodeAmount();//要生成的条码数量
String poNo = StringUtils.isEmpty(mesBaseBarcodeInfo.getPoNo()) ? "0" : mesBaseBarcodeInfo.getPoNo();
String batchCode = this.getRawBatchCode(poNo);
if (!mesBaseMaterialInfo.getAlwaysFlag().equals(MesConstants.MES_MATERIAL_ALWAYS_FLAG_YES)) {
// if (!mesBaseMaterialInfo.getAlwaysFlag().equals(MesConstants.MES_MATERIAL_ALWAYS_FLAG_YES)) {
Long orderBindId = mesBaseBarcodeInfo.getOrderBindId();
if (orderBindId == null) {
throw new ServiceException("请选择绑定销售订单信息的采购订单");
@ -217,16 +221,16 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
mesOrderBindMapper.updateMesOrderBind(mesOrderBind);
} else {
MesBaseBarcodeInfo toInsertedBarcodeInfo;
for (long i = 0; i < barcodeAmount.intValue(); i++) {
// 生成条码数量的不同条码内容
toInsertedBarcodeInfo = getInsertedBarcodeInfo(mesBaseBarcodeInfo, Seq.getId(Seq.mesBarcodeSeqType, Seq.mesBarcodeCode), batchCode, userName, currentDate);
toInsertedBarcodeInfo.setSaleOrderId(0L);
toInsertedBarcodeInfo.setSafeFlag(MesConstants.MES_ORDER_BIND_SAFE_FLAG_YES);
mesBaseBarcodeInfoMapper.insertMesBaseBarcodeInfo(toInsertedBarcodeInfo);
}
}
// } else {
// MesBaseBarcodeInfo toInsertedBarcodeInfo;
// for (long i = 0; i < barcodeAmount.intValue(); i++) {
// // 生成条码数量的不同条码内容
// toInsertedBarcodeInfo = getInsertedBarcodeInfo(mesBaseBarcodeInfo, Seq.getId(Seq.mesBarcodeSeqType, Seq.mesBarcodeCode), batchCode, userName, currentDate);
// toInsertedBarcodeInfo.setSaleOrderId(0L);
// toInsertedBarcodeInfo.setSafeFlag(MesConstants.MES_ORDER_BIND_SAFE_FLAG_YES);
// mesBaseBarcodeInfoMapper.insertMesBaseBarcodeInfo(toInsertedBarcodeInfo);
// }
// }
}
@ -623,184 +627,132 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
* @return
*/
@Override
@Transactional
@Transactional(rollbackFor = Exception.class)
public int printBarcodes(Long[] barcodeIds, String printType, boolean reprintFlag, Integer printNumber) {
//获取条码List
// List<List<PrintContentVo>> printContents = new ArrayList<>();
// List<MesBaseBarcodeInfo> toUpdatedBaseBarcodeInfos = new ArrayList<>();
JSONArray pintBarcodeJsonArr = new JSONArray();
JSONObject printContentJson = new JSONObject();
String barcodeType = "";
for (Long barcodeId : barcodeIds) {
MesBaseBarcodeInfo mesBaseBarcodeInfo = mesBaseBarcodeInfoMapper.selectMesBaseBarcodeInfoByBarcodeId(barcodeId);
if (StringUtils.isEmpty(barcodeType)) {
barcodeType = mesBaseBarcodeInfo.getBarcodeType();
}
this.updateBaseBarcodePrintFlag(mesBaseBarcodeInfo, reprintFlag);
if (printNumber != null && printNumber > 1) {
for (int i = 0; i < printNumber; i++) {
printBarcodesByBarcodeId(barcodeId, printType, reprintFlag);
JSONObject printBarcodeJson = getBarcodeJsonByBarcode(mesBaseBarcodeInfo, printType);
pintBarcodeJsonArr.add(printBarcodeJson);
}
} else {
printBarcodesByBarcodeId(barcodeId, printType, reprintFlag);
JSONObject printBarcodeJson = getBarcodeJsonByBarcode(mesBaseBarcodeInfo, printType);
pintBarcodeJsonArr.add(printBarcodeJson);
}
}
// for (MesBaseBarcodeInfo toUpdateMesBaseBarcodeInfo : toUpdatedBaseBarcodeInfos) {
// toUpdateMesBaseBarcodeInfo.setPrintTime(DateUtils.getNowDate());
// toUpdateMesBaseBarcodeInfo.setPrintPerson(SecurityUtils.getUsername());
// toUpdateMesBaseBarcodeInfo.setPrintFlag(MesConstants.MES_BARCODE_PRINT_FLAG_YES);
// toUpdateMesBaseBarcodeInfo.setPrintNumber(1L);
// toUpdateMesBaseBarcodeInfo.setAcceptedDate(DateUtils.getNowDate());
// this.updateMesBaseBarcodeInfo(toUpdateMesBaseBarcodeInfo);
// }
//
// PrinterVo printerVo = new PrinterVo();
// printerVo.setPrintType(printType);
// printerVo.setPrintContents(printContents);
//
// //调用的打印接口
// R<?> printResultR = remotePrinterService.printBarcodes(printerVo, SecurityConstants.INNER);
// if (printResultR.getCode() != Constants.SUCCESS) {//抛出异常,回滚事务
// throw new RuntimeException(printResultR.getMsg());
// }
String printTemplate = "";
if (barcodeType.equals(MesConstants.MES_BARCODE_TYPE_RAW)) {
printTemplate = PrintContentVo.PRINT_TEMPLATE_RAW;
} else if (barcodeType.equals(MesConstants.MES_BARCODE_TYPE_PRODUCT)) {
printTemplate = PrintContentVo.PRINT_TEMPLATE_PRODUCT;
} else if (barcodeType.equals(MesConstants.MES_BARCODE_TYPE_BIND)) {
printTemplate = PrintContentVo.PRINT_TEMPLATE_BIND;
}
printContentJson.put("template", printTemplate);
printContentJson.put("printContent", pintBarcodeJsonArr.toString());
System.out.println(printContentJson.toString());
try {
String hostIp = IpUtils.getIpAddr();
String printKey = "print_" + hostIp;
redisTemplate.opsForList().rightPush(printKey, printContentJson.toString());
// redisTemplate.convertAndSend("print_10.10.3.119", printContentJson.toString());
} catch (Exception e) {
throw new ServiceException("打印失败:" + e.getMessage());
}
return 1;
}
@Transactional(propagation = Propagation.REQUIRES_NEW)
public void printBarcodesByBarcodeId(Long barcodeId, String printType, boolean reprintFlag) {
MesBaseBarcodeInfo mesBaseBarcodeInfo = mesBaseBarcodeInfoMapper.selectMesBaseBarcodeInfoJoinByBarcodeId(barcodeId);
if (!reprintFlag) {
public void updateBaseBarcodePrintFlag(MesBaseBarcodeInfo mesBaseBarcodeInfo, boolean reprintFlag) {
String barcodeType = mesBaseBarcodeInfo.getBarcodeType();
if (!reprintFlag && !barcodeType.equals(MesConstants.MES_BARCODE_TYPE_BIND)) {
String printFlag = mesBaseBarcodeInfo.getPrintFlag();
if (printFlag.equals(MesConstants.MES_BARCODE_PRINT_FLAG_YES)) {
throw new ServiceException("此物料条码[" + mesBaseBarcodeInfo.getBarcodeInfo() + "]已经打印过,不能重复打印");
}
}
String materialName = mesBaseBarcodeInfo.getMaterialName();
List<PrintContentVo> printContentVos = new ArrayList<>();
PrintContentVo printMaterialCode = new PrintContentVo();
printMaterialCode.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_MATERIAL_CODE);
printMaterialCode.setValue(mesBaseBarcodeInfo.getMaterialCode());
printMaterialCode.setType(PrintContentVo.TYPE_TEXT);
PrintContentVo printPreMaterial = new PrintContentVo();
// if (mesBaseBarcodeInfo.getBindFlag() == null) {
//
// }
PrintContentVo printSaleOrderCode = new PrintContentVo();
printSaleOrderCode.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_SALE_ORDER_CODE);
printSaleOrderCode.setValue(mesBaseBarcodeInfo.getSaleorderCode());
printSaleOrderCode.setType(PrintContentVo.TYPE_TEXT);
PrintContentVo printBarCode = new PrintContentVo();
printBarCode.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_QRCODE);
printBarCode.setValue(mesBaseBarcodeInfo.getBarcodeInfo());
printBarCode.setType(PrintContentVo.TYPE_QRCODE);
if (printType.equals(PrinterVo.PRINT_TYPE_RAW_LABEL)) {
PrintContentVo printMaterialName = new PrintContentVo();
printMaterialName.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_MATERIAL_NAME);
materialName = materialName.length() <= 10 ? "\n" + materialName : materialName;
printMaterialName.setValue(materialName.replaceAll("[\\x00-\\x1F\\x7F-\\x9F]", ""));
printMaterialName.setType(PrintContentVo.TYPE_TEXT);
PrintContentVo printBatchCode = new PrintContentVo();
printBatchCode.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_BATCH_CODE);
printBatchCode.setValue(mesBaseBarcodeInfo.getBatchCode());
printBatchCode.setType(PrintContentVo.TYPE_TEXT);
PrintContentVo printPoNo = new PrintContentVo();
printPoNo.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_PO_NO);
printPoNo.setValue(mesBaseBarcodeInfo.getPoNo());
printPoNo.setType(PrintContentVo.TYPE_TEXT);
//常备物料为安全库存
String printPreMaterialKey = mesBaseBarcodeInfo.getAlwaysFlag() != null && mesBaseBarcodeInfo.getAlwaysFlag().equals(MesConstants.MES_MATERIAL_ALWAYS_FLAG_YES)
? PrintContentVo.RAW_MATERIAL_LABEL_KEY_PRE_MATERIAL_YES : PrintContentVo.RAW_MATERIAL_LABEL_KEY_PRE_MATERIAL_NO;
printPreMaterial.setKey(printPreMaterialKey);
printPreMaterial.setType(PrintContentVo.TYPE_CHECKBOX);
PrintContentVo printMaterialSpec = new PrintContentVo();
printMaterialSpec.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_MATERIAL_SPEC);
if (StringUtils.isNotEmpty(mesBaseBarcodeInfo.getBarcodeSpec())) {
printMaterialSpec.setValue(mesBaseBarcodeInfo.getBarcodeSpec().replaceAll("[\\x00-\\x1F\\x7F-\\x9F]", ""));
}
printMaterialSpec.setType(PrintContentVo.TYPE_TEXT);
PrintContentVo printQty = new PrintContentVo();
printQty.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_QTY);
DecimalFormat df = new DecimalFormat("#.##");
String formattedNumber = df.format(mesBaseBarcodeInfo.getAmount() == null ? BigDecimal.ZERO : mesBaseBarcodeInfo.getAmount());
printQty.setValue(formattedNumber);
printQty.setType(PrintContentVo.TYPE_TEXT);
printContentVos.add(printMaterialName);
printContentVos.add(printBatchCode);
printContentVos.add(printPoNo);
printContentVos.add(printMaterialSpec);
printContentVos.add(printQty);
} else if (printType.equals(PrinterVo.PRINT_TYPE_PRODUCT_LABEL)) {
PrintContentVo printMaterialName = new PrintContentVo();
materialName = materialName.length() <= 8 ? "\n" + materialName : materialName;
printMaterialName.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_MATERIAL_NAME);
printMaterialName.setValue(materialName);
printMaterialName.setType(PrintContentVo.TYPE_TEXT);
PrintContentVo printQty = new PrintContentVo();
printQty.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_QTY);
printQty.setValue("1");
printQty.setType(PrintContentVo.TYPE_TEXT);
PrintContentVo printPlanCode = new PrintContentVo();
printPlanCode.setKey(PrintContentVo.PRODUCT_PLAN_CODE);
printPlanCode.setValue(mesBaseBarcodeInfo.getPlanCode());
printPlanCode.setType(PrintContentVo.TYPE_TEXT);
printContentVos.add(printMaterialName);
printContentVos.add(printQty);
printContentVos.add(printPlanCode);
}
printContentVos.add(printMaterialCode);
printContentVos.add(printPreMaterial);
printContentVos.add(printSaleOrderCode);
printContentVos.add(printBarCode);
String checkStatus = mesBaseBarcodeInfo.getCheckStatus() == null ? "" : mesBaseBarcodeInfo.getCheckStatus();
if (checkStatus.equals(QmsConstants.QMS_CHECK_RESULT_CHECK_STATUS_PASS)) {
PrintContentVo printQcResult = new PrintContentVo();
printQcResult.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_QC_RESULT_YES);
printQcResult.setType(PrintContentVo.TYPE_CHECKBOX);
printContentVos.add(printQcResult);
} else if (checkStatus.equals(QmsConstants.QMS_CHECK_RESULT_CHECK_STATUS_FAIL)) {
PrintContentVo printQcResult = new PrintContentVo();
printQcResult.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_QC_RESULT_NO);
printQcResult.setType(PrintContentVo.TYPE_CHECKBOX);
printContentVos.add(printQcResult);
}
// printContents.add(printContentVos);
// toUpdatedBaseBarcodeInfos.add(mesBaseBarcodeInfo);
Date currentDate = new Date();
mesBaseBarcodeInfo.setUpdateTime(currentDate);
mesBaseBarcodeInfo.setUpdateBy(SecurityUtils.getUsername());
mesBaseBarcodeInfo.setPrintTime(DateUtils.getNowDate());
mesBaseBarcodeInfo.setPrintPerson(SecurityUtils.getUsername());
mesBaseBarcodeInfo.setPrintFlag(MesConstants.MES_BARCODE_PRINT_FLAG_YES);
mesBaseBarcodeInfo.setPrintNumber(mesBaseBarcodeInfo.getPrintNumber() == null ? 1L : mesBaseBarcodeInfo.getPrintNumber() + 1);
mesBaseBarcodeInfo.setAcceptedDate(DateUtils.getNowDate());
this.updateMesBaseBarcodeInfo(mesBaseBarcodeInfo);
mesBaseBarcodeInfo.setAcceptedDate(currentDate);
mesBaseBarcodeInfoMapper.updateMesBaseBarcodeInfo(mesBaseBarcodeInfo);
}
PrinterVo printerVo = new PrinterVo();
printerVo.setPrintType(printType);
printerVo.setPrintContentVos(printContentVos);
// @Transactional(propagation = Propagation.REQUIRES_NEW)
public JSONObject getBarcodeJsonByBarcode(MesBaseBarcodeInfo mesBaseBarcodeInfo, String printType) {
String materialName = mesBaseBarcodeInfo.getMaterialName();
JSONObject printInfoObject = new JSONObject();
printInfoObject.put(PrintContentVo.RAW_MATERIAL_LABEL_KEY_MATERIAL_CODE, mesBaseBarcodeInfo.getMaterialCode());
printInfoObject.put(PrintContentVo.RAW_MATERIAL_LABEL_KEY_SALE_ORDER_CODE, mesBaseBarcodeInfo.getSaleorderCode());
printInfoObject.put(PrintContentVo.RAW_MATERIAL_LABEL_KEY_QRCODE, mesBaseBarcodeInfo.getBarcodeInfo());
if (printType.equals(PrinterVo.PRINT_TYPE_RAW_LABEL)) {
// materialName = materialName.length() <= 10 ? "\n" + materialName : materialName;
// printMaterialName.setValue(materialName.replaceAll("[\\x00-\\x1F\\x7F-\\x9F]", ""));
// printMaterialName.setType(PrintContentVo.TYPE_TEXT);
printInfoObject.put(PrintContentVo.RAW_MATERIAL_LABEL_KEY_MATERIAL_NAME, materialName);
printInfoObject.put(PrintContentVo.RAW_MATERIAL_LABEL_KEY_BARCODE, mesBaseBarcodeInfo.getBarcodeInfo());
printInfoObject.put(PrintContentVo.RAW_MATERIAL_LABEL_KEY_BATCH_CODE, mesBaseBarcodeInfo.getBatchCode());
printInfoObject.put(PrintContentVo.RAW_MATERIAL_LABEL_KEY_PO_NO, mesBaseBarcodeInfo.getPoNo());
//常备物料为安全库存
// String printPreMaterialKey = mesBaseBarcodeInfo.getAlwaysFlag() != null && mesBaseBarcodeInfo.getAlwaysFlag().equals(MesConstants.MES_MATERIAL_ALWAYS_FLAG_YES)
// ? PrintContentVo.RAW_MATERIAL_LABEL_KEY_PRE_MATERIAL_YES : PrintContentVo.RAW_MATERIAL_LABEL_KEY_PRE_MATERIAL_NO;
// printPreMaterial.setKey(printPreMaterialKey);
// printPreMaterial.setType(PrintContentVo.TYPE_CHECKBOX);
printInfoObject.put(PrintContentVo.RAW_MATERIAL_LABEL_KEY_MATERIAL_SPEC, mesBaseBarcodeInfo.getBarcodeSpec() == null ? ""
: mesBaseBarcodeInfo.getBarcodeSpec().replaceAll("[\\x00-\\x1F\\x7F-\\x9F]", ""));
// PrintContentVo printQty = new PrintContentVo();
// printQty.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_QTY);
// DecimalFormat df = new DecimalFormat("#.##");
// String formattedNumber = df.format(mesBaseBarcodeInfo.getAmount() == null ? BigDecimal.ZERO : mesBaseBarcodeInfo.getAmount());
// printQty.setValue(formattedNumber);
// printQty.setType(PrintContentVo.TYPE_TEXT);
} else if (printType.equals(PrinterVo.PRINT_TYPE_PRODUCT_LABEL)) {
printInfoObject.put(PrintContentVo.RAW_MATERIAL_LABEL_KEY_MATERIAL_NAME, materialName);
printInfoObject.put(PrintContentVo.RAW_MATERIAL_LABEL_KEY_MATERIAL_SPEC, mesBaseBarcodeInfo.getBarcodeSpec() == null ? ""
: mesBaseBarcodeInfo.getBarcodeSpec().replaceAll("[\\x00-\\x1F\\x7F-\\x9F]", ""));
printInfoObject.put(PrintContentVo.RAW_MATERIAL_LABEL_KEY_BARCODE, mesBaseBarcodeInfo.getBarcodeInfo());
printInfoObject.put(PrintContentVo.PRODUCT_PLAN_CODE, mesBaseBarcodeInfo.getPlanCode());
printInfoObject.put(PrintContentVo.RAW_MATERIAL_LABEL_KEY_QTY, "1");
//调用的打印接口
R<?> printResultR = remotePrinterService.printBarcodes(printerVo, SecurityConstants.INNER);
if (printResultR.getCode() != Constants.SUCCESS) {
throw new RuntimeException(printResultR.getMsg());
}
return printInfoObject;
}
@ -1434,7 +1386,7 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
Long materialId = this.insertNewVirtualMaterial(barcodeInfo, userName, currentDate);
//创建虚拟销售订单,保存对应的销售订单列表
MesSaleOrder virtualSaleOrder = this.insertNewVirtualSaleOrder(materialId, barcodeInfo, mesSaleOrderRelateList, userName, currentDate);
MesSaleOrder virtualSaleOrder = this.insertNewVirtualSaleOrder(materialId, barcodeInfo, mesBaseBarcodeInfo.getSaleorderCode(), mesSaleOrderRelateList, userName, currentDate);
//创建虚拟bom并合并销售订单的bom信息
this.insertVirtualMaterialBom(materialId, barcodeInfo, toUpdatedMaterialBoms, userName, currentDate);
@ -1448,7 +1400,7 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
toInsertedBarcodeInfo.setPurchaseOrderId(-1L);
toInsertedBarcodeInfo.setMaterialId(materialId);
toInsertedBarcodeInfo.setSaleOrderId(virtualSaleOrder.getSaleOrderId());
toInsertedBarcodeInfo.setSaleorderCode(virtualSaleOrder.getSaleorderCode());
toInsertedBarcodeInfo.setSaleorderCode(mesBaseBarcodeInfo.getSaleorderCode());
toInsertedBarcodeInfo.setSafeFlag(MesConstants.MES_ORDER_BIND_SAFE_FLAG_NO);
toInsertedBarcodeInfo.setSingleFlag(MesConstants.MES_BARCODE_SINGLE_FLAG_MERGE);
// toInsertedBarcodeInfo.setBarcodeSpec(materialCodes.toString());
@ -1490,7 +1442,7 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
}
public MesSaleOrder insertNewVirtualSaleOrder(Long materialId, String barcodeInfo,
public MesSaleOrder insertNewVirtualSaleOrder(Long materialId, String barcodeInfo, String saleOrderCode,
List<MesSaleOrderRelate> mesSaleOrderRelates, String userName, Date currentDate) {
@ -1504,7 +1456,7 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
mesSaleOrder.setMaterialCode(barcodeInfo);
mesSaleOrder.setMaterialName(barcodeInfo);
mesSaleOrder.setOrderAmount(BigDecimal.ONE);
mesSaleOrder.setSaleorderCode(Seq.getId(Seq.mesVirtualSaleOrderSeqType, Seq.mesVirtualSaleOrderCode));
mesSaleOrder.setSaleorderCode(saleOrderCode);
mesSaleOrder.setIsRelease(MesConstants.MES_SALE_ORDER_IS_RELEASE_TO_PUBLISH);
// mesSaleOrder.setPlanDeliveryDate();
mesSaleOrder.setSaleOrderClassfication(MesConstants.MES_SALE_ORDER_CLASSFICATION_VIRTUAL);
@ -1667,13 +1619,31 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
userName, currentDate);
//新增的绑定信息
StringBuilder errorMsgBuilder = this.handleInsertSaleOrderRelates(mesSaleOrderRelateList,mesBaseBarcodeInfo, virtualMaterialBom, userName, currentDate);
StringBuilder errorMsgBuilder = this.handleInsertSaleOrderRelates(mesSaleOrderRelateList, mesBaseBarcodeInfo, virtualMaterialBom, userName, currentDate);
if (errorMsgBuilder.length() > 0) {
throw new ServiceException(errorMsgBuilder.toString());
}
// 判断是否要更新虚拟订单的销售订单号
if (dbMesSaleOrderRelateList != null && !dbMesSaleOrderRelateList.isEmpty()
&& mesSaleOrderRelateList != null && !mesSaleOrderRelateList.isEmpty()) {
MesSaleOrderRelate toDeletedMesSaleOrderRelate = dbMesSaleOrderRelateList.get(0);
String oldSaleOrderCode = toDeletedMesSaleOrderRelate.getRelateSaleOrderCode();
MesSaleOrderRelate toInsertedMesSaleOrder = mesSaleOrderRelateList.get(0);
String newSaleOrderCode = toInsertedMesSaleOrder.getRelateSaleOrderCode();
if (!oldSaleOrderCode.equals(newSaleOrderCode)) {
MesSaleOrder virtualSaleOrder = mesSaleOrderMapper.selectMesSaleOrderBySaleOrderId(toDeletedMesSaleOrderRelate.getSaleOrderId());
virtualSaleOrder.setSaleorderCode(newSaleOrderCode);
virtualSaleOrder.setUpdateTime(currentDate);
virtualSaleOrder.setUpdateBy(userName);
mesSaleOrderMapper.updateMesSaleOrder(virtualSaleOrder);
}
}
//生成条码
mesBaseBarcodeInfo.setUpdateBy(userName);
@ -1727,7 +1697,7 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
}
public StringBuilder handleInsertSaleOrderRelates(List<MesSaleOrderRelate> toInsertedSaleOrderRelateList,MesBaseBarcodeInfo baseBarcodeInfo,
public StringBuilder handleInsertSaleOrderRelates(List<MesSaleOrderRelate> toInsertedSaleOrderRelateList, MesBaseBarcodeInfo baseBarcodeInfo,
MesMaterialBom virtualMaterialBom, String userName, Date currentDate) {
StringBuilder errorMsgBuilder = new StringBuilder();
List<MesMaterialBom> toUpdatedMaterialBoms = new ArrayList<>();
@ -2066,4 +2036,194 @@ public class MesBaseBarcodeInfoServiceImpl implements IMesBaseBarcodeInfoService
// return 1;
// }
// /**
// * 打印物料条码
// *
// * @param barcodeIds
// * @param printType 打印类型1原材料 3成品
// * @param reprintFlag 重新打印标识(1重新打印)
// * @param printNumber 打印数量
// * @return
// */
// @Override
// @Transactional
// public int printBarcodes(Long[] barcodeIds, String printType, boolean reprintFlag, Integer printNumber) {
// //获取条码List
//// List<List<PrintContentVo>> printContents = new ArrayList<>();
//// List<MesBaseBarcodeInfo> toUpdatedBaseBarcodeInfos = new ArrayList<>();
//
// for (Long barcodeId : barcodeIds) {
// if (printNumber != null && printNumber > 1) {
// for (int i = 0; i < printNumber; i++) {
// printBarcodesByBarcodeId(barcodeId, printType, reprintFlag);
// }
// } else {
// printBarcodesByBarcodeId(barcodeId, printType, reprintFlag);
// }
//
// }
//
//// for (MesBaseBarcodeInfo toUpdateMesBaseBarcodeInfo : toUpdatedBaseBarcodeInfos) {
//// toUpdateMesBaseBarcodeInfo.setPrintTime(DateUtils.getNowDate());
//// toUpdateMesBaseBarcodeInfo.setPrintPerson(SecurityUtils.getUsername());
//// toUpdateMesBaseBarcodeInfo.setPrintFlag(MesConstants.MES_BARCODE_PRINT_FLAG_YES);
//// toUpdateMesBaseBarcodeInfo.setPrintNumber(1L);
//// toUpdateMesBaseBarcodeInfo.setAcceptedDate(DateUtils.getNowDate());
//// this.updateMesBaseBarcodeInfo(toUpdateMesBaseBarcodeInfo);
//// }
////
//// PrinterVo printerVo = new PrinterVo();
//// printerVo.setPrintType(printType);
//// printerVo.setPrintContents(printContents);
////
//// //调用的打印接口
//// R<?> printResultR = remotePrinterService.printBarcodes(printerVo, SecurityConstants.INNER);
//// if (printResultR.getCode() != Constants.SUCCESS) {//抛出异常,回滚事务
//// throw new RuntimeException(printResultR.getMsg());
//// }
//
// return 1;
//
// }
// @Transactional(propagation = Propagation.REQUIRES_NEW)
// public void printBarcodesByBarcodeId(Long barcodeId, String printType, boolean reprintFlag) {
// MesBaseBarcodeInfo mesBaseBarcodeInfo = mesBaseBarcodeInfoMapper.selectMesBaseBarcodeInfoJoinByBarcodeId(barcodeId);
// if (!reprintFlag) {
// String printFlag = mesBaseBarcodeInfo.getPrintFlag();
// if (printFlag.equals(MesConstants.MES_BARCODE_PRINT_FLAG_YES)) {
// throw new ServiceException("此物料条码[" + mesBaseBarcodeInfo.getBarcodeInfo() + "]已经打印过,不能重复打印");
// }
// }
//
// String materialName = mesBaseBarcodeInfo.getMaterialName();
// List<PrintContentVo> printContentVos = new ArrayList<>();
//
// PrintContentVo printMaterialCode = new PrintContentVo();
// printMaterialCode.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_MATERIAL_CODE);
// printMaterialCode.setValue(mesBaseBarcodeInfo.getMaterialCode());
// printMaterialCode.setType(PrintContentVo.TYPE_TEXT);
//
// PrintContentVo printPreMaterial = new PrintContentVo();
//// if (mesBaseBarcodeInfo.getBindFlag() == null) {
////
//// }
//
// PrintContentVo printSaleOrderCode = new PrintContentVo();
// printSaleOrderCode.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_SALE_ORDER_CODE);
// printSaleOrderCode.setValue(mesBaseBarcodeInfo.getSaleorderCode());
// printSaleOrderCode.setType(PrintContentVo.TYPE_TEXT);
//
//
// PrintContentVo printBarCode = new PrintContentVo();
// printBarCode.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_QRCODE);
// printBarCode.setValue(mesBaseBarcodeInfo.getBarcodeInfo());
// printBarCode.setType(PrintContentVo.TYPE_QRCODE);
//
// if (printType.equals(PrinterVo.PRINT_TYPE_RAW_LABEL)) {
// PrintContentVo printMaterialName = new PrintContentVo();
// printMaterialName.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_MATERIAL_NAME);
// materialName = materialName.length() <= 10 ? "\n" + materialName : materialName;
// printMaterialName.setValue(materialName.replaceAll("[\\x00-\\x1F\\x7F-\\x9F]", ""));
// printMaterialName.setType(PrintContentVo.TYPE_TEXT);
//
// PrintContentVo printBatchCode = new PrintContentVo();
// printBatchCode.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_BATCH_CODE);
// printBatchCode.setValue(mesBaseBarcodeInfo.getBatchCode());
// printBatchCode.setType(PrintContentVo.TYPE_TEXT);
//
// PrintContentVo printPoNo = new PrintContentVo();
// printPoNo.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_PO_NO);
// printPoNo.setValue(mesBaseBarcodeInfo.getPoNo());
// printPoNo.setType(PrintContentVo.TYPE_TEXT);
//
// //常备物料为安全库存
// String printPreMaterialKey = mesBaseBarcodeInfo.getAlwaysFlag() != null && mesBaseBarcodeInfo.getAlwaysFlag().equals(MesConstants.MES_MATERIAL_ALWAYS_FLAG_YES)
// ? PrintContentVo.RAW_MATERIAL_LABEL_KEY_PRE_MATERIAL_YES : PrintContentVo.RAW_MATERIAL_LABEL_KEY_PRE_MATERIAL_NO;
// printPreMaterial.setKey(printPreMaterialKey);
// printPreMaterial.setType(PrintContentVo.TYPE_CHECKBOX);
//
// PrintContentVo printMaterialSpec = new PrintContentVo();
// printMaterialSpec.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_MATERIAL_SPEC);
// if (StringUtils.isNotEmpty(mesBaseBarcodeInfo.getBarcodeSpec())) {
// printMaterialSpec.setValue(mesBaseBarcodeInfo.getBarcodeSpec().replaceAll("[\\x00-\\x1F\\x7F-\\x9F]", ""));
// }
// printMaterialSpec.setType(PrintContentVo.TYPE_TEXT);
//
// PrintContentVo printQty = new PrintContentVo();
// printQty.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_QTY);
// DecimalFormat df = new DecimalFormat("#.##");
// String formattedNumber = df.format(mesBaseBarcodeInfo.getAmount() == null ? BigDecimal.ZERO : mesBaseBarcodeInfo.getAmount());
// printQty.setValue(formattedNumber);
// printQty.setType(PrintContentVo.TYPE_TEXT);
//
// printContentVos.add(printMaterialName);
// printContentVos.add(printBatchCode);
// printContentVos.add(printPoNo);
// printContentVos.add(printMaterialSpec);
// printContentVos.add(printQty);
//
// } else if (printType.equals(PrinterVo.PRINT_TYPE_PRODUCT_LABEL)) {
// PrintContentVo printMaterialName = new PrintContentVo();
// materialName = materialName.length() <= 8 ? "\n" + materialName : materialName;
// printMaterialName.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_MATERIAL_NAME);
// printMaterialName.setValue(materialName);
// printMaterialName.setType(PrintContentVo.TYPE_TEXT);
//
// PrintContentVo printQty = new PrintContentVo();
// printQty.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_QTY);
// printQty.setValue("1");
// printQty.setType(PrintContentVo.TYPE_TEXT);
//
// PrintContentVo printPlanCode = new PrintContentVo();
// printPlanCode.setKey(PrintContentVo.PRODUCT_PLAN_CODE);
// printPlanCode.setValue(mesBaseBarcodeInfo.getPlanCode());
// printPlanCode.setType(PrintContentVo.TYPE_TEXT);
// printContentVos.add(printMaterialName);
// printContentVos.add(printQty);
// printContentVos.add(printPlanCode);
// }
//
// printContentVos.add(printMaterialCode);
// printContentVos.add(printPreMaterial);
// printContentVos.add(printSaleOrderCode);
// printContentVos.add(printBarCode);
//
// String checkStatus = mesBaseBarcodeInfo.getCheckStatus() == null ? "" : mesBaseBarcodeInfo.getCheckStatus();
// if (checkStatus.equals(QmsConstants.QMS_CHECK_RESULT_CHECK_STATUS_PASS)) {
// PrintContentVo printQcResult = new PrintContentVo();
// printQcResult.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_QC_RESULT_YES);
// printQcResult.setType(PrintContentVo.TYPE_CHECKBOX);
// printContentVos.add(printQcResult);
// } else if (checkStatus.equals(QmsConstants.QMS_CHECK_RESULT_CHECK_STATUS_FAIL)) {
// PrintContentVo printQcResult = new PrintContentVo();
// printQcResult.setKey(PrintContentVo.RAW_MATERIAL_LABEL_KEY_QC_RESULT_NO);
// printQcResult.setType(PrintContentVo.TYPE_CHECKBOX);
// printContentVos.add(printQcResult);
// }
//
//// printContents.add(printContentVos);
//// toUpdatedBaseBarcodeInfos.add(mesBaseBarcodeInfo);
//
// mesBaseBarcodeInfo.setPrintTime(DateUtils.getNowDate());
// mesBaseBarcodeInfo.setPrintPerson(SecurityUtils.getUsername());
// mesBaseBarcodeInfo.setPrintFlag(MesConstants.MES_BARCODE_PRINT_FLAG_YES);
// mesBaseBarcodeInfo.setPrintNumber(mesBaseBarcodeInfo.getPrintNumber() == null ? 1L : mesBaseBarcodeInfo.getPrintNumber() + 1);
// mesBaseBarcodeInfo.setAcceptedDate(DateUtils.getNowDate());
// this.updateMesBaseBarcodeInfo(mesBaseBarcodeInfo);
//
//
// PrinterVo printerVo = new PrinterVo();
// printerVo.setPrintType(printType);
// printerVo.setPrintContentVos(printContentVos);
//
// //调用的打印接口
// R<?> printResultR = remotePrinterService.printBarcodes(printerVo, SecurityConstants.INNER);
// if (printResultR.getCode() != Constants.SUCCESS) {
// throw new RuntimeException(printResultR.getMsg());
// }
//
// }
}

@ -10,16 +10,16 @@ import com.hw.common.core.domain.R;
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 com.hw.wms.api.RemoteWmsService;
import com.hw.wms.api.domain.WmsWarehouseMaterial;
import com.hw.wms.api.domain.vo.WmsProductStockVo;
import com.hw.wms.api.domain.vo.WmsRawStockVo;
import com.hw.wms.api.domain.vo.WmsWarehouseMaterialExistVo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -172,6 +172,15 @@ public class MesBasePalletInfoServiceImpl implements IMesBasePalletInfoService {
throw new ServiceException("此物料条码存在原材料库存,不能绑定");
}
if(mesBaseBarcodeInfo.getBarcodeType().equals(MesConstants.MES_BARCODE_TYPE_RAW)){
WmsWarehouseMaterial wmsWarehouseMaterial = new WmsWarehouseMaterial();
wmsWarehouseMaterial.setStorageId(mesBaseBarcodeInfo.getMaterialId());
R<Boolean> isExistWarehouseMaterial = remoteWmsService.isExistWarehouseMaterial(wmsWarehouseMaterial, SecurityConstants.INNER);
if (!isExistWarehouseMaterial.getData()) {
throw new ServiceException("此物料还没有配置仓库信息");
}
}
String userName = SecurityUtils.getUsername();
Date currentDate = new Date();

@ -372,7 +372,7 @@ public class MesProductOrderServiceImpl implements IMesProductOrderService {
productOrder.setProductOrderId(mesProductOrder.getProductOrderId());
productOrder.setOrderStatus(MesConstants.PUBLISHED);
productOrder.setReleaseTime(DateUtils.getNowDate());
return this.updateMesProductOrder(productOrder);
return mesProductOrderMapper.updateMesProductOrder(productOrder);
}
/**

@ -190,7 +190,7 @@ public class MesPurchaseApplyServiceImpl implements IMesPurchaseApplyService {
String materialName = purchaseRequisitionTemplate.getMaterialName();
String productModel = purchaseRequisitionTemplate.getProductModel();
//产品规格型号把excel中的除.的符号都去掉(包括空格换行)
productModel = productModel.replaceAll("[^\\w.]", "");
productModel = productModel.replaceAll("[^\\u4e00-\\u9fa5a-zA-Z0-9\\.]", "");
MesBaseMaterialInfo materialInfo = new MesBaseMaterialInfo();
materialInfo.setMaterialName(materialName);
List<MesBaseMaterialInfo> materialInfoList = mesBaseMaterialInfoMapper.selectMesBaseMaterialInfoList(materialInfo);
@ -199,7 +199,7 @@ public class MesPurchaseApplyServiceImpl implements IMesPurchaseApplyService {
MesBaseMaterialInfo findMaterialInfo = new MesBaseMaterialInfo();
for (MesBaseMaterialInfo baseMaterialInfo : materialInfoList) {
String materialSpec = baseMaterialInfo.getMaterialSpec();
materialSpec = materialSpec.replaceAll("[^\\w.]", "");
materialSpec = materialSpec.replaceAll("[^\\u4e00-\\u9fa5a-zA-Z0-9\\.]", "");
if (materialSpec.equals(productModel)) {
successFlag++;
findMaterialInfo = baseMaterialInfo;
@ -208,7 +208,10 @@ public class MesPurchaseApplyServiceImpl implements IMesPurchaseApplyService {
if (successFlag == 1) {
MesBaseUnitInfo baseUnitInfo = mesBaseUnitInfoMapper.selectMesBaseUnitInfoByErpId(findMaterialInfo.getMaterialUnitId());
MesBaseUnitInfo priceUnitIdUnitInfo = mesBaseUnitInfoMapper.selectMesBaseUnitInfoByErpId(findMaterialInfo.getPurchasePriceUnitId());
if (baseUnitInfo == null || priceUnitIdUnitInfo == null) {
failureNum++;
failureMsg.append("<br/>").append(failureNum).append(" 未找到单位信息 导入失败");
}
MesPurchaseApplyDetail mesPurchaseApplyDetail = new MesPurchaseApplyDetail();
mesPurchaseApplyDetail.setTondBase(purchaseRequisitionTemplate.getTondBase());
@ -237,6 +240,7 @@ public class MesPurchaseApplyServiceImpl implements IMesPurchaseApplyService {
failureMsg.append("<br/>").append(failureNum).append(" 未找到物料记录 导入失败");
}
} catch (Exception e) {
e.printStackTrace();
failureNum++;
String msg = "<br/>" + failureNum + " 导入失败:";
failureMsg.append(msg).append(e.getMessage());
@ -267,7 +271,7 @@ public class MesPurchaseApplyServiceImpl implements IMesPurchaseApplyService {
public int syncMesPurchaseApply(MesPurchaseApply mesPurchaseApply) {
Date currentDate = new Date();
MesPurchaseApply dbMesPurchaseApply = mesPurchaseApplyMapper.selectOnlyMesPurchaseApplyByPurchaseApplyId(mesPurchaseApply.getPurchaseApplyId());
if(dbMesPurchaseApply.getSyncStatus().equals(MesConstants.MES_PURCHASE_APPALY_SYNC_YES)){
if (dbMesPurchaseApply.getSyncStatus().equals(MesConstants.MES_PURCHASE_APPALY_SYNC_YES)) {
throw new ServiceException("此采购申请单已经同步");
}

@ -153,14 +153,14 @@ public class MesPurchaseOrderServiceImpl implements IMesPurchaseOrderService {
if (mesBaseMaterialInfo == null) {
throw new ServiceException("物料信息不存在");
}
String alwaysFlag = mesBaseMaterialInfo.getAlwaysFlag();
if (alwaysFlag == null) {
throw new ServiceException("请先设置物料信息是否为常备物料");
}
if (alwaysFlag.equals(MesConstants.MES_MATERIAL_ALWAYS_FLAG_YES)) {
throw new ServiceException("此物料为常备物料,不需要绑定");
}
// String alwaysFlag = mesBaseMaterialInfo.getAlwaysFlag();
// if (alwaysFlag == null) {
// throw new ServiceException("请先设置物料信息是否为常备物料");
// }
//
// if (alwaysFlag.equals(MesConstants.MES_MATERIAL_ALWAYS_FLAG_YES)) {
// throw new ServiceException("此物料为常备物料,不需要绑定");
// }
Long purchaseOrderId = mesPurchaseOrder.getPurchaseOrderId();

@ -8,8 +8,11 @@ import com.hw.common.core.utils.DateUtils;
import com.hw.common.core.utils.StringUtils;
import com.hw.common.security.utils.SecurityUtils;
import com.hw.mes.api.domain.MesBaseBarcodeInfo;
import com.hw.mes.api.domain.MesSaleOrderRelate;
import com.hw.mes.api.domain.vo.MesBaseBarcodeInfoTransferVo;
import com.hw.mes.api.domain.vo.MesSaleOrderTransferVo;
import com.hw.mes.mapper.MesBaseBarcodeInfoMapper;
import com.hw.mes.mapper.MesSaleOrderRelateMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hw.mes.mapper.MesSaleOrderMapper;
@ -31,6 +34,9 @@ public class MesSaleOrderServiceImpl implements IMesSaleOrderService {
@Autowired
private MesBaseBarcodeInfoMapper mesBaseBarcodeInfoMapper;
@Autowired
private MesSaleOrderRelateMapper mesSaleOrderRelateMapper;
/**
*
*
@ -144,14 +150,18 @@ public class MesSaleOrderServiceImpl implements IMesSaleOrderService {
mesSaleOrderMapper.updateMesSaleOrder(newSaleOrder);
}
List<MesBaseBarcodeInfo> mesBaseBarcodeInfos = mesSaleOrderTransferVo.getMesBaseBarcodeInfos();
List<MesBaseBarcodeInfoTransferVo> mesBaseBarcodeInfoTransferVos = mesSaleOrderTransferVo.getMesBaseBarcodeInfoTransferVos();
int updateSize = 0;
for (MesBaseBarcodeInfo mesBaseBarcodeInfo : mesBaseBarcodeInfos) {
MesBaseBarcodeInfo dbMesBaseBarcodeInfo = mesBaseBarcodeInfoMapper.selectMesBaseBarcodeInfoByBarcodeInfo(mesBaseBarcodeInfo.getBarcodeInfo());
for (MesBaseBarcodeInfoTransferVo mesBaseBarcodeInfoTransferVo : mesBaseBarcodeInfoTransferVos) {
MesBaseBarcodeInfo dbMesBaseBarcodeInfo = mesBaseBarcodeInfoMapper.selectMesBaseBarcodeInfoByBarcodeInfo(mesBaseBarcodeInfoTransferVo.getBarcodeInfo());
if (dbMesBaseBarcodeInfo == null) {
return false;
}
MesBaseBarcodeInfo mesBaseBarcodeInfo = new MesBaseBarcodeInfo();
mesBaseBarcodeInfo.setBarcodeId(dbMesBaseBarcodeInfo.getBarcodeId());
mesBaseBarcodeInfo.setSaleOrderId(mesBaseBarcodeInfoTransferVo.getSaleOrderId());
mesBaseBarcodeInfo.setSaleorderCode(mesBaseBarcodeInfoTransferVo.getSaleOrderCode());
mesBaseBarcodeInfo.setSafeFlag(mesBaseBarcodeInfoTransferVo.getSafeFlag());
mesBaseBarcodeInfo.setUpdateBy(SecurityUtils.getUsername());
mesBaseBarcodeInfo.setUpdateTime(DateUtils.getNowDate());
updateSize += mesBaseBarcodeInfoMapper.updateMesBaseBarcodeInfo(mesBaseBarcodeInfo);
@ -160,4 +170,16 @@ public class MesSaleOrderServiceImpl implements IMesSaleOrderService {
return updateSize > 0;
}
/**
* relatesaleorderId
* @param saleOrderId
* @return
*/
@Override
public List<MesSaleOrderRelate> getRelateProductsBySaleOrderId(Long saleOrderId){
MesSaleOrderRelate querySaleOrderRelate = new MesSaleOrderRelate();
querySaleOrderRelate.setSaleOrderId(saleOrderId);
return mesSaleOrderRelateMapper.selectMesSaleOrderRelateJoinProductList(querySaleOrderRelate);
}
}

@ -130,6 +130,7 @@
<if test="autoOutstockFlag != null and autoOutstockFlag != ''">and bmi.auto_outstock_flag = #{autoOutstockFlag}</if>
<if test="accessoriesFlag != null and accessoriesFlag != ''">and bmi.accessories_flag = #{accessoriesFlag}</if>
<if test="lowValueConsumableFlag != null and lowValueConsumableFlag != ''">and bmi.low_value_consumable_flag = #{lowValueConsumableFlag}</if>
<if test="alwaysFlag != null and alwaysFlag != ''">and bmi.always_flag = #{alwaysFlag}</if>
<if test="selectType != null and selectType !=''">and exists (select 1 from wms_warehouse_material wwm where wwm.storage_type='1' and wwm.warehouse_id=511 and wwm.storage_id=bmi.material_id)</if>

@ -52,6 +52,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="syncStatus != null and syncStatus != ''"> and sync_status = #{syncStatus}</if>
<if test="syncTime != null "> and sync_time = #{syncTime}</if>
</where>
order by purchase_apply_id desc
</select>
<select id="selectMesPurchaseApplyByPurchaseApplyId" parameterType="Long" resultMap="MesPurchaseApplyMesPurchaseApplyDetailResult">

@ -21,10 +21,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="materialCode" column="material_code" />
<result property="materialName" column="material_name" />
<result property="materialSpec" column="material_spec" />
<result property="productCode" column="product_code" />
<result property="productName" column="product_name" />
<result property="productSpec" column="product_spec" />
</resultMap>
<sql id="selectMesSaleOrderRelateVo">
select sale_order_relate_id, sale_order_id,barcode_info, order_bind_id,relate_sale_order_id,material_id, relate_sale_order_amount from mes_sale_order_relate
select sale_order_relate_id, sale_order_id,barcode_info, order_bind_id,relate_sale_order_id,relate_sale_order_code,material_id, relate_sale_order_amount from mes_sale_order_relate
</sql>
<select id="selectMesSaleOrderRelateList" parameterType="MesSaleOrderRelate" resultMap="MesSaleOrderRelateResult">
@ -127,4 +131,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where bind_barcode= #{bindBarcode} limit 1
</select>
<select id="selectMesSaleOrderRelateJoinProductList" parameterType="MesSaleOrderRelate" resultMap="MesSaleOrderRelateResult">
select msor.sale_order_relate_id, msor.sale_order_id,msor.barcode_info, msor.order_bind_id,msor.relate_sale_order_id,msor.relate_sale_order_code,
msor.material_id, msor.relate_sale_order_amount,msor.purchase_order_id,msor.product_id,
mbmi.material_code as product_code,mbmi.material_name as product_name,mbmi.material_spec as product_spec
from mes_sale_order_relate msor
left join mes_base_material_info mbmi on msor.product_id=mbmi.material_id
<where>
<if test="barcodeInfo != null and barcodeInfo != '' "> and barcode_info = #{barcodeInfo}</if>
<if test="saleOrderId != null "> and sale_order_id = #{saleOrderId}</if>
<if test="relateSaleOrderId != null "> and relate_sale_order_id = #{relateSaleOrderId}</if>
<if test="purchaseOrderId != null "> and purchase_order_id = #{purchaseOrderId}</if>
<if test="relateSaleOrderAmount != null "> and relate_sale_order_amount = #{relateSaleOrderAmount}</if>
</where>
</select>
</mapper>

@ -77,6 +77,10 @@
<groupId>com.hw</groupId>
<artifactId>hw-common-swagger</artifactId>
</dependency>
<dependency>
<groupId>com.hw</groupId>
<artifactId>hw-api-mes</artifactId>
</dependency>
</dependencies>

@ -72,25 +72,16 @@ public class QmsMobileController extends BaseController {
//扫描物料条码进入获取
String materialBarcode = qmsMaterialCheckVo.getMaterialBarcode();
MesBaseBarcodeInfo baseBarcodeInfo = mesBaseBarcodeInfoService.selectMesBaseBarcodeInfoByBarcodeInfo(materialBarcode);
if (baseBarcodeInfo == null) {
throw new ServiceException("物料条码有误");
}
QmsCheckResultDetail qmsCheckResultDetail = qmsCheckResultDetailService.getCheckResultDetail(materialBarcode);
if (qmsCheckResultDetail != null) {//如果有质检结果,则返回已经保存的质检结果,否则返回需要质检的项目
return success(qmsCheckResultDetail);
} else {
MesBaseBarcodeInfo baseBarcodeInfo = mesBaseBarcodeInfoService.selectMesBaseBarcodeInfoByBarcodeInfo(materialBarcode);
if (baseBarcodeInfo == null) {
throw new ServiceException("物料条码有误");
}
Long materialId = baseBarcodeInfo.getMaterialId();
QmsCheckRuleDetail queryCheckRuleDetail = new QmsCheckRuleDetail();
queryCheckRuleDetail.setTargetId(materialId);
queryCheckRuleDetail.setTargetType(QmsConstants.QMS_CHECK_RULE_DETAIL_TARGET_TYPE_MATERIAL);
QmsCheckRule qmsCheckRule = qmsCheckRuleService.selectQmsCheckRuleByTarget(queryCheckRuleDetail);
if (qmsCheckRule == null) {
throw new ServiceException("无此物料的质检规则");
}
qmsCheckRule.setMaterialId(materialId);
qmsCheckRule.setMaterialCode(baseBarcodeInfo.getMaterialCode());
qmsCheckRule.setMaterialName(baseBarcodeInfo.getMaterialName());
QmsCheckRule qmsCheckRule = qmsCheckRuleService.selectQmsCheckRuleByBarcode(baseBarcodeInfo);
Long checkResultId = qmsCheckResultService.insertCheckResult(baseBarcodeInfo, qmsCheckRule);
qmsCheckRule.setCheckResultId(checkResultId);
return success(qmsCheckRule);

@ -95,7 +95,7 @@ public class MesBaseBarcodeInfo extends BaseEntity
private String planDetailCode;
/** 销售订单ID;适合生产出入库等 */
private String saleOrderId;
private Long saleOrderId;
/** 销售订单编号;适合生产出入库等 */
@Excel(name = "销售订单编号;适合生产出入库等")
@ -126,6 +126,9 @@ public class MesBaseBarcodeInfo extends BaseEntity
private String materialName;
private String singleFlag;
public void setBarcodeId(Long barcodeId)
{
this.barcodeId = barcodeId;
@ -289,11 +292,11 @@ public class MesBaseBarcodeInfo extends BaseEntity
return planDetailCode;
}
public String getSaleOrderId() {
public Long getSaleOrderId() {
return saleOrderId;
}
public void setSaleOrderId(String saleOrderId) {
public void setSaleOrderId(Long saleOrderId) {
this.saleOrderId = saleOrderId;
}
@ -368,6 +371,14 @@ public class MesBaseBarcodeInfo extends BaseEntity
this.materialName = materialName;
}
public String getSingleFlag() {
return singleFlag;
}
public void setSingleFlag(String singleFlag) {
this.singleFlag = singleFlag;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

@ -1,6 +1,8 @@
package com.hw.qms.service;
import java.util.List;
import com.hw.qms.domain.MesBaseBarcodeInfo;
import com.hw.qms.domain.QmsCheckRule;
import com.hw.qms.domain.QmsCheckRuleDetail;
import com.hw.qms.domain.QmsCheckRuleProject;
@ -81,4 +83,13 @@ public interface IQmsCheckRuleService
* @return
*/
public QmsCheckRule selectQmsCheckRuleByTarget(QmsCheckRuleDetail qmsCheckRuleDetail);
/**
* check_rule_project
*
* @param baseBarcodeInfo
* @return
*/
public QmsCheckRule selectQmsCheckRuleByBarcode(MesBaseBarcodeInfo baseBarcodeInfo);
}

@ -156,7 +156,7 @@ public class QmsCheckResultServiceImpl implements IQmsCheckResultService {
qmsCheckResult.setCheckSample(qmsCheckRule.getCheckSample());
qmsCheckResult.setPlanCode(mesBaseBarcodeInfo.getPlanCode());
qmsCheckResult.setPlanDetailCode(mesBaseBarcodeInfo.getPlanDetailCode());
qmsCheckResult.setSaleOrderId(mesBaseBarcodeInfo.getSaleOrderId());
qmsCheckResult.setSaleOrderId(mesBaseBarcodeInfo.getSaleOrderId() == null ? "" : String.valueOf(mesBaseBarcodeInfo.getSaleOrderId()));
qmsCheckResult.setSaleorderCode(mesBaseBarcodeInfo.getSaleorderCode());
qmsCheckResult.setPoNo(mesBaseBarcodeInfo.getPoNo());
qmsCheckResult.setCheckStatus(QmsConstants.QMS_CHECK_RESULT_CHECK_STATUS_CHECKED);

@ -3,10 +3,16 @@ package com.hw.qms.service.impl;
import java.util.Date;
import java.util.List;
import com.hw.common.core.constant.MesConstants;
import com.hw.common.core.constant.QmsConstants;
import com.hw.common.core.constant.SecurityConstants;
import com.hw.common.core.constant.WmsConstants;
import com.hw.common.core.domain.R;
import com.hw.common.core.exception.ServiceException;
import com.hw.common.core.utils.DateUtils;
import com.hw.common.security.utils.SecurityUtils;
import com.hw.mes.api.RemoteMesService;
import com.hw.mes.api.domain.MesSaleOrderRelate;
import com.hw.qms.domain.*;
import com.hw.qms.domain.vo.QmsMaterialCheckVo;
import com.hw.qms.mapper.*;
@ -19,6 +25,8 @@ import com.hw.common.core.utils.StringUtils;
import org.springframework.transaction.annotation.Transactional;
import com.hw.qms.service.IQmsCheckRuleService;
import javax.annotation.Resource;
/**
* Service
*
@ -33,6 +41,12 @@ public class QmsCheckRuleServiceImpl implements IQmsCheckRuleService {
@Autowired
private QmsCheckResultDetailMapper qmsCheckResultDetailMapper;
@Autowired
private MesBaseBarcodeInfoMapper mesBaseBarcodeInfoMapper;
@Resource
private RemoteMesService remoteMesService;
/**
*
@ -127,20 +141,16 @@ public class QmsCheckRuleServiceImpl implements IQmsCheckRuleService {
*
* @param qmsCheckRule
*/
public void insertQmsCheckRuleProject(QmsCheckRule qmsCheckRule)
{
public void insertQmsCheckRuleProject(QmsCheckRule qmsCheckRule) {
List<QmsCheckRuleProject> qmsCheckRuleProjectList = qmsCheckRule.getQmsCheckRuleProjectList();
Long checkRuleId = qmsCheckRule.getCheckRuleId();
if (StringUtils.isNotNull(qmsCheckRuleProjectList))
{
if (StringUtils.isNotNull(qmsCheckRuleProjectList)) {
List<QmsCheckRuleProject> list = new ArrayList<QmsCheckRuleProject>();
for (QmsCheckRuleProject qmsCheckRuleProject : qmsCheckRuleProjectList)
{
for (QmsCheckRuleProject qmsCheckRuleProject : qmsCheckRuleProjectList) {
qmsCheckRuleProject.setCheckRuleId(checkRuleId);
list.add(qmsCheckRuleProject);
}
if (list.size() > 0)
{
if (list.size() > 0) {
qmsCheckRuleMapper.batchQmsCheckRuleProject(list);
}
}
@ -149,6 +159,7 @@ public class QmsCheckRuleServiceImpl implements IQmsCheckRuleService {
/**
*
*
* @param checkRuleDetailList
*/
@Override
@ -159,6 +170,7 @@ public class QmsCheckRuleServiceImpl implements IQmsCheckRuleService {
/**
*
*
* @param checkRuleProjectList
*/
@Override
@ -179,4 +191,59 @@ public class QmsCheckRuleServiceImpl implements IQmsCheckRuleService {
}
/**
* check_rule_project
*
* @param baseBarcodeInfo
* @return
*/
@Override
public QmsCheckRule selectQmsCheckRuleByBarcode(MesBaseBarcodeInfo baseBarcodeInfo) {
Long materialId = 0L;
if (baseBarcodeInfo.getSingleFlag().equals(MesConstants.MES_BARCODE_SINGLE_FLAG_MERGE)) {//如果是合并的物料
if (baseBarcodeInfo.getBarcodeType().equals(MesConstants.MES_BARCODE_TYPE_RAW)) {
R<List<MesSaleOrderRelate>> materialSaleOrderRelateListData = remoteMesService.getRelateMaterialsBySaleOrderId(baseBarcodeInfo.getSaleOrderId(), SecurityConstants.INNER);
if (materialSaleOrderRelateListData == null) {
throw new ServiceException("未找到拆分物料信息");
}
List<MesSaleOrderRelate> materialSaleOrderRelateList = materialSaleOrderRelateListData.getData();
if (materialSaleOrderRelateList == null || materialSaleOrderRelateList.isEmpty()) {
throw new ServiceException("未找到拆分物料信息!");
}
MesSaleOrderRelate materialSaleOrderRelate = materialSaleOrderRelateList.get(0);
materialId = materialSaleOrderRelate.getMaterialId();
} else if (baseBarcodeInfo.getBarcodeType().equals(MesConstants.MES_BARCODE_TYPE_PRODUCT)) {
R<List<MesSaleOrderRelate>> productSaleOrderRelateListData = remoteMesService.getRelateProductsBySaleOrderId(baseBarcodeInfo.getSaleOrderId(), SecurityConstants.INNER);
if (productSaleOrderRelateListData == null) {
throw new ServiceException("未找到拆分成品信息");
}
List<MesSaleOrderRelate> productSaleOrderRelateList = productSaleOrderRelateListData.getData();
if (productSaleOrderRelateList == null || productSaleOrderRelateList.isEmpty()) {
throw new ServiceException("未找到拆分成品信息");
}
MesSaleOrderRelate productSaleOrderRelate = productSaleOrderRelateList.get(0);
materialId = productSaleOrderRelate.getProductId();
}
} else {
materialId = baseBarcodeInfo.getMaterialId();
}
QmsCheckRuleDetail queryCheckRuleDetail = new QmsCheckRuleDetail();
queryCheckRuleDetail.setTargetId(materialId);
queryCheckRuleDetail.setTargetType(QmsConstants.QMS_CHECK_RULE_DETAIL_TARGET_TYPE_MATERIAL);
QmsCheckRule qmsCheckRule = qmsCheckRuleMapper.selectQmsCheckRuleByTarget(queryCheckRuleDetail);
if (qmsCheckRule == null) {
throw new ServiceException("无此物料的质检规则");
}
qmsCheckRule.setMaterialId(materialId);
qmsCheckRule.setMaterialCode(baseBarcodeInfo.getMaterialCode());
qmsCheckRule.setMaterialName(baseBarcodeInfo.getMaterialName());
return qmsCheckRule;
}
}

@ -75,7 +75,7 @@ public class QmsQualityInstanceServiceImpl implements IQmsQualityInstanceService
* @param qmsQualityInstance
* @return
*/
@Transactional
@Transactional(rollbackFor = Exception.class)
@Override
public int insertQmsQualityInstance(QmsQualityInstance qmsQualityInstance) {
qmsQualityInstance.setCreateTime(DateUtils.getNowDate());

@ -35,10 +35,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateTime" column="update_time" />
<result property="materialCode" column="material_code" />
<result property="materialName" column="material_name" />
<result property="singleFlag" column="single_flag" />
</resultMap>
<sql id="selectMesBaseBarcodeInfoVo">
select barcode_id, print_time, print_person, batch_flag, barcode_type, barcode_info, batch_code, pallet_info_code, material_id, manufacturer_id, amount, machine_name, po_no, production_date, accepted_date, last_outstock_date, plan_code, plan_detail_code, sale_order_id, saleorder_code, project_no, serial_number, remark, bind_status, bind_by, bind_time, update_by, update_time from mes_base_barcode_info
select barcode_id, print_time, print_person, batch_flag, barcode_type, barcode_info, batch_code, pallet_info_code, material_id, manufacturer_id, amount, machine_name, po_no, production_date, accepted_date, last_outstock_date, plan_code, plan_detail_code, sale_order_id, saleorder_code, project_no, serial_number, remark, bind_status, bind_by, bind_time, update_by, update_time,single_flag from mes_base_barcode_info
</sql>
<select id="selectMesBaseBarcodeInfoList" parameterType="MesBaseBarcodeInfo" resultMap="MesBaseBarcodeInfoResult">
@ -182,7 +183,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectMesBaseBarcodeInfoByBarcodeInfo" parameterType="String" resultMap="MesBaseBarcodeInfoResult">
select mbbi.barcode_id, mbbi.batch_flag, mbbi.barcode_type, mbbi.barcode_info, mbbi.batch_code,
select mbbi.barcode_id, mbbi.batch_flag, mbbi.barcode_type, mbbi.barcode_info, mbbi.batch_code,mbbi.single_flag,
mbbi.material_id, mbbi.amount, mbbi.po_no,mbbi.plan_code, mbbi.plan_detail_code, mbbi.sale_order_id, mbbi.saleorder_code,
mbmi.material_code,mbmi.material_name
from mes_base_barcode_info mbbi left join mes_base_material_info mbmi on mbbi.material_id = mbmi.material_id

@ -165,16 +165,23 @@ public class WmsBaseWarehouseController extends BaseController {
}
@Log(title = "仓库管理", businessType = BusinessType.ALLOCATE)
@PostMapping("/allocateVirtualMaterial")
@InnerAuth
public R<Boolean> allocateVirtualMaterial(@RequestBody WmsWarehouseMaterial wmsWarehouseMaterial) {
public R<Boolean> allocateVirtualMaterial(@RequestBody WmsWarehouseMaterial wmsWarehouseMaterial) {
boolean isSuccess = wmsWarehouseMaterialService.insertWmsWarehouseMaterial(wmsWarehouseMaterial) > 0;
return R.ok(isSuccess);
}
@PostMapping("/isExistWarehouseMaterial")
@InnerAuth
public R<Boolean> isExistWarehouseMaterial(@RequestBody WmsWarehouseMaterial wmsWarehouseMaterial) {
List<WmsWarehouseMaterial> wmsWarehouseMaterials = wmsWarehouseMaterialService.selectWmsWarehouseMaterialList(wmsWarehouseMaterial);
boolean isSuccess = wmsWarehouseMaterials != null && !wmsWarehouseMaterials.isEmpty();
return R.ok(isSuccess);
}
// /**
// * 根据仓库分配可入库物料信息

@ -205,6 +205,7 @@ public class WmsMobileController extends BaseController {
WmsRawReturn wmsRawReturn = new WmsRawReturn();
wmsRawReturn.setAuditStatus(WmsConstants.WMS_AUDIT_STATUS_PASS);
wmsRawReturn.setExecuteStatus(WmsConstants.WMS_EXECUTE_STATUS_NOT_FINISH);
wmsRawReturn.setOperationType(WmsConstants.WMS_OPERATION_TYPE_MANUAL);
List<WmsRawReturn> list = wmsRawReturnService.selectWmsRawReturnJoinList(wmsRawReturn);
return getDataTable(list);
}
@ -412,7 +413,7 @@ public class WmsMobileController extends BaseController {
@Log(title = "组装返库", businessType = BusinessType.INSERT)
@PostMapping(("/assembleBack"))
public AjaxResult assembleBack(@Validated @RequestBody WmsAssembleOutstockVo wmsAssembleOutstockVo) {
if(!wmsAssembleOutstockVo.getMaterialBarcode().equals("")) {
if (!wmsAssembleOutstockVo.getMaterialBarcode().equals("")) {
throw new ServiceException("组装返库");
}
return toAjax(1);
@ -429,14 +430,6 @@ public class WmsMobileController extends BaseController {
}
//todo入库时校验warehousematerial,入库出库需要校验库位状态,是否是移库合库锁定等
/**
*
@ -455,7 +448,7 @@ public class WmsMobileController extends BaseController {
public TableDataInfo getMoveList(WmsMove wmsMove) {
startPage();
wmsMove.setMoveWay(WmsConstants.WMS_MOVEMERGE_WAY_MANUAL);
wmsMove.setExecuteStatusStr(WmsConstants.WMS_EXECUTE_STATUS_TOEXECUTE + "," + WmsConstants.WMS_MOVE_EXECUTE_STATUS_EXECUTING+ "," + WmsConstants.WMS_MOVE_EXECUTE_STATUS_OUTSTOCK_FINISH);
wmsMove.setExecuteStatusStr(WmsConstants.WMS_EXECUTE_STATUS_TOEXECUTE + "," + WmsConstants.WMS_MOVE_EXECUTE_STATUS_EXECUTING + "," + WmsConstants.WMS_MOVE_EXECUTE_STATUS_OUTSTOCK_FINISH);
List<WmsMove> wmsMoves = wmsMoveService.selectWmsMoveJoinList(wmsMove);
return getDataTable(wmsMoves);
}
@ -491,7 +484,6 @@ public class WmsMobileController extends BaseController {
}
/**
*
*/
@ -499,6 +491,7 @@ public class WmsMobileController extends BaseController {
@GetMapping(value = "/getInventoryChecks")
public TableDataInfo getInventoryChecks(WmsInventoryCheck queryInventoryCheck) {
startPage();
queryInventoryCheck.setCheckType(WmsConstants.WMS_INVENTORY_CHECK_TYPE_MANUAL);
List<WmsInventoryCheck> inventoryChecks = wmsInventoryCheckService.selectWmsInventoryCheckJoinList(queryInventoryCheck);
return getDataTable(inventoryChecks);
}
@ -550,6 +543,7 @@ public class WmsMobileController extends BaseController {
//TODO 盘点中的不能进行移库合库?
/**
*
*/
@ -560,7 +554,6 @@ public class WmsMobileController extends BaseController {
}
/**
*
*/
@ -569,4 +562,54 @@ public class WmsMobileController extends BaseController {
public AjaxResult completeInventoryCheck(@RequestBody WmsInventoryCheck wmsInventoryCheck) {
return success(wmsInventoryCheckService.completeInventoryCheck(wmsInventoryCheck));
}
/**
* 退
*/
@Log(title = "退货出库", businessType = BusinessType.INSERT)
@PostMapping(("/returnOutstock"))
public AjaxResult returnOutstock(@RequestBody WmsReturnOutstockVo wmsReturnOutstockVo) {
return success(wmsRawOutstockService.returnOutstock(wmsReturnOutstockVo));
}
/**
* 退
*/
@GetMapping(value = "/getReturnRawOutstocks")
public TableDataInfo getReturnRawOutstocks(WmsRawOutstock wmsRawOutstock) {
startPage();
wmsRawOutstock.setTaskType(WmsConstants.WMS_RAW_OUTSTOCK_TASK_TYPE_RETURN_OUTSTOCK);
return getDataTable(wmsRawOutstockService.selectWmsRawOutstockList(wmsRawOutstock));
}
/**
*
*/
@Log(title = "库位", businessType = BusinessType.LOCK)
@PostMapping(("/lockLocation"))
public AjaxResult lockLocation(@RequestBody WmsLocationLockUnLockVo wmsLocationLockUnLockVo) {
return success(wmsBaseLocationService.lockWmsBaseLocationByLocationCode(wmsLocationLockUnLockVo.getLocationCode()));
}
/**
*
*/
@Log(title = "库位", businessType = BusinessType.UNLOCK)
@PostMapping(("/unlockLocation"))
public AjaxResult unlockLocation(@RequestBody WmsLocationLockUnLockVo wmsLocationLockUnLockVo) {
return success(wmsBaseLocationService.unlockWmsBaseLocationByLocationCode(wmsLocationLockUnLockVo.getLocationCode()));
}
@GetMapping(value = "/getLockLocations")
public AjaxResult getLockLocations(WmsBaseLocation wmsBaseLocation) {
Map<String, List<String>> locationMap = wmsBaseLocationService.getLocationCodesGroupByWarehouse(wmsBaseLocation);
System.out.println(locationMap);
return success(locationMap);
}
}

@ -160,7 +160,7 @@ public class WmsRawOutstockController extends BaseController
/**
*
*/
@RequiresPermissions("wms:rawoutstock:apply")
// @RequiresPermissions("wms:rawoutstock:apply")
@GetMapping("/getWarehouses4Apply")
public AjaxResult getWarehouses4Apply(WmsBaseWarehouse queryBaseWarehouse) {
queryBaseWarehouse.setWarehouseInstockType(WmsConstants.WMS_WAREHOUSE_INSTOCK_TYPE_RAW);
@ -172,7 +172,7 @@ public class WmsRawOutstockController extends BaseController
/**
*
*/
@RequiresPermissions("wms:rawoutstock:apply")
// @RequiresPermissions("wms:rawoutstock:apply")
@GetMapping("/getStockTotal")
public TableDataInfo getStockTotal(WmsStockTotal queryStockTotal) {
startPage();

@ -33,6 +33,9 @@ public class WmsInventoryCheck extends BaseEntity
@Excel(name = "盘点状态(0待盘点", readConverterExp = "暂=无此状态")
private String checkStatus;
/**盘点类型(1人工2调度,3,CTU)*/
private String checkType;
/** 盘点开始时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "盘点开始时间", width = 30, dateFormat = "yyyy-MM-dd")
@ -106,6 +109,15 @@ public class WmsInventoryCheck extends BaseEntity
{
return checkStatus;
}
public String getCheckType() {
return checkType;
}
public void setCheckType(String checkType) {
this.checkType = checkType;
}
public void setBeginTime(Date beginTime)
{
this.beginTime = beginTime;

@ -93,7 +93,7 @@ public class WmsRawInstock extends BaseEntity
private String applyBy;
/** 入库时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "入库时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date applyDate;

@ -153,7 +153,7 @@ public class WmsRawOutstock extends BaseEntity {
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "申请时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date applyDate;

@ -0,0 +1,21 @@
package com.hw.wms.domain.vo;
import lombok.Data;
import javax.validation.constraints.NotBlank;
/**
* @Description: VO
* @ClassName: WmsLocationLockUnLockVo
* @Author : xins
* @Date :2024-10-29
* @Version :1.0
*/
@Data
public class WmsLocationLockUnLockVo {
//库位码
@NotBlank(message="库位码必须输入")
private String locationCode;
}

@ -0,0 +1,28 @@
package com.hw.wms.domain.vo;
import lombok.Data;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
/**
* @Description: 退VO
* @ClassName: WmsReturnOutstockVo
* @Author : xins
* @Date :2024-10-29
* @Version :1.0
*/
@Data
public class WmsReturnOutstockVo {
//库位码
@NotBlank(message="库位码必须输入")
private String locationCode;
//库位码
private String materialBarcode;
private BigDecimal returnAmount;
}

@ -1,6 +1,7 @@
package com.hw.wms.service;
import java.util.List;
import java.util.Map;
import com.hw.common.core.utils.DateUtils;
import com.hw.wms.domain.WmsBaseLocation;
@ -77,6 +78,14 @@ public interface IWmsBaseLocationService
*/
public int lockWmsBaseLocation(Long locationId);
/**
*
*
* @param locationCode
* @return
*/
public int lockWmsBaseLocationByLocationCode(String locationCode);
/**
*
*
@ -85,6 +94,14 @@ public interface IWmsBaseLocationService
*/
public int unlockWmsBaseLocation(Long locationId);
/**
*
*
* @param locationCode
* @return
*/
public int unlockWmsBaseLocationByLocationCode(String locationCode);
/**
*
*
@ -110,4 +127,10 @@ public interface IWmsBaseLocationService
*/
public int deleteWmsLocationBarcodeByLocationBarcodeIds(Long[] locationBarcodeIds);
/**
* group
* @param wmsBaseLocation
* @return
*/
public Map<String,List<String>> getLocationCodesGroupByWarehouse(WmsBaseLocation wmsBaseLocation);
}

@ -155,5 +155,12 @@ public interface IWmsRawOutstockService
* @return
*/
public WmsRawOutstock getNewestOutstockCabinet(WmsRawOutstock wmsRawOutstock);
/**
* 退
* @param wmsReturnOutstockVo
* @return
*/
public int returnOutstock(WmsReturnOutstockVo wmsReturnOutstockVo);
}

@ -1,6 +1,7 @@
package com.hw.wms.service.impl;
import com.hw.common.core.constant.SecurityConstants;
import com.hw.common.core.constant.WmsConstants;
import com.hw.common.core.enums.WmsLocationStatus;
import com.hw.common.core.exception.ServiceException;
import com.hw.common.core.utils.DateUtils;
@ -19,10 +20,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
/**
* Service
@ -128,6 +127,8 @@ public class WmsBaseLocationServiceImpl implements IWmsBaseLocationService {
}
/**
*
*
@ -139,6 +140,24 @@ public class WmsBaseLocationServiceImpl implements IWmsBaseLocationService {
// wmsBaseLocation.setCreateTime(DateUtils.getNowDate());
// return wmsBaseLocationMapper.insertWmsBaseLocation(wmsBaseLocation);
WmsBaseLocation baseLocation = wmsBaseLocationMapper.selectWmsBaseLocationByLocationId(locationId);
return this.lockLocation(baseLocation);
}
/**
*
*
* @param locationCode
* @return
*/
@Override
public int lockWmsBaseLocationByLocationCode(String locationCode) {
// wmsBaseLocation.setCreateTime(DateUtils.getNowDate());
// return wmsBaseLocationMapper.insertWmsBaseLocation(wmsBaseLocation);
WmsBaseLocation baseLocation = wmsBaseLocationMapper.selectWmsBaseLocationByLocationCode(locationCode);
return this.lockLocation(baseLocation);
}
public int lockLocation(WmsBaseLocation baseLocation){
String locationStatus = baseLocation.getLocationStatus();
if (locationStatus.equals(WmsLocationStatus.MANUALLOCK.getCode())) {
return 1;
@ -151,6 +170,7 @@ public class WmsBaseLocationServiceImpl implements IWmsBaseLocationService {
return wmsBaseLocationMapper.updateWmsBaseLocation(baseLocation);
}
/**
*
*
@ -160,6 +180,22 @@ public class WmsBaseLocationServiceImpl implements IWmsBaseLocationService {
@Override
public int unlockWmsBaseLocation(Long locationId) {
WmsBaseLocation baseLocation = wmsBaseLocationMapper.selectWmsBaseLocationByLocationId(locationId);
return this.unlockLocation(baseLocation);
}
/**
*
*
* @param locationCode
* @return
*/
@Override
public int unlockWmsBaseLocationByLocationCode(String locationCode) {
WmsBaseLocation baseLocation = wmsBaseLocationMapper.selectWmsBaseLocationByLocationCode(locationCode);
return this.unlockLocation(baseLocation);
}
public int unlockLocation(WmsBaseLocation baseLocation) {
String locationStatus = baseLocation.getLocationStatus();
if (locationStatus.equals(WmsLocationStatus.NORMAL.getCode())) {
return 1;
@ -247,4 +283,23 @@ public class WmsBaseLocationServiceImpl implements IWmsBaseLocationService {
public int deleteWmsLocationBarcodeByLocationBarcodeIds(Long[] locationBarcodeIds) {
return wmsLocationBarcodeMapper.deleteWmsLocationBarcodeByLocationBarcodeIds(locationBarcodeIds);
}
/**
* group
* @param wmsBaseLocation
* @return
*/
@Override
public Map<String,List<String>> getLocationCodesGroupByWarehouse(WmsBaseLocation wmsBaseLocation){
wmsBaseLocation.setLocationStatus(WmsConstants.WMS_BASE_LOCATION_STATUS_MANUAL_LOCK);
List<WmsBaseLocation> wmsBaseLocations = wmsBaseLocationMapper.selectWmsBaseLocationJoinList(wmsBaseLocation);
Map<String,List<String>> locationCodesByWarehouse = wmsBaseLocations.stream()
.collect(Collectors.groupingBy(
WmsBaseLocation::getWarehouseName,
Collectors.mapping(WmsBaseLocation::getLocationCode, Collectors.toList())
));
return locationCodesByWarehouse;
}
}

@ -78,7 +78,7 @@ public class WmsInventoryCheckServiceImpl implements IWmsInventoryCheckService {
* @param wmsInventoryCheckVo VO
* @return
*/
@Transactional
@Transactional(rollbackFor = Exception.class)
@Override
public Long insertWmsInventoryCheck(WmsInventoryCheckVo wmsInventoryCheckVo) {
Long inventoryCheckId = wmsInventoryCheckVo.getInventoryCheckId();
@ -89,6 +89,18 @@ public class WmsInventoryCheckServiceImpl implements IWmsInventoryCheckService {
String userName = SecurityUtils.getUsername();
Date currentDate = new Date();
WmsBaseWarehouse baseWarehouse = wmsBaseWarehouseMapper.selectWmsBaseWarehouseByWarehouseId(warehouseId);
String warehouseInstockType = baseWarehouse.getWarehouseInstockType();
String warehouseType = baseWarehouse.getWarehouseType();
String inventoryCheckType = "";
if(warehouseType.equals(WmsConstants.WMS_WAREHOUSE_TYPE_NORMAL)){
inventoryCheckType = WmsConstants.WMS_INVENTORY_CHECK_TYPE_MANUAL;
}else if(warehouseType.equals(WmsConstants.WMS_WAREHOUSE_TYPE_AGV)){
inventoryCheckType = WmsConstants.WMS_INVENTORY_CHECK_TYPE_WCS;
}else{
throw new ServiceException("请选择人工仓库或agv仓库盘库");
}
if (inventoryCheckId == null || inventoryCheckId.equals(0L) || inventoryCheckId.equals(-1L)) {
WmsInventoryCheck queryInventoryCheck = new WmsInventoryCheck();
queryInventoryCheck.setWarehouseId(warehouseId);
@ -105,6 +117,7 @@ public class WmsInventoryCheckServiceImpl implements IWmsInventoryCheckService {
WmsInventoryCheck wmsInventoryCheck = new WmsInventoryCheck();
wmsInventoryCheck.setInventoryCheckCode(Seq.getId(Seq.wmsInventoryCheckSeqType, Seq.wmsInventoryCheckSeqCode));
wmsInventoryCheck.setWarehouseId(warehouseId);
wmsInventoryCheck.setCheckType(inventoryCheckType);
wmsInventoryCheck.setLocationAmount((long) locationAmount);
wmsInventoryCheck.setInventoryingAmount((long) locationCodes.size());
wmsInventoryCheck.setBeginTime(currentDate);
@ -122,8 +135,7 @@ public class WmsInventoryCheckServiceImpl implements IWmsInventoryCheckService {
wmsInventoryCheckMapper.updateWmsInventoryCheck(toUpdatedInventoryCheck);
}
WmsBaseWarehouse baseWarehouse = wmsBaseWarehouseMapper.selectWmsBaseWarehouseByWarehouseId(warehouseId);
String warehouseInstockType = baseWarehouse.getWarehouseInstockType();
List<WmsInventoryCheckDetail> wmsInventoryCheckDetails = new ArrayList<>();
for (String locationCode : locationCodes) {

@ -184,15 +184,41 @@ public class WmsMoveServiceImpl implements IWmsMoveService {
WmsBaseWarehouse baseWareHouse = wmsBaseWarehouseMapper.
selectWmsBaseWarehouseByWarehouseId(oriLocation.getWarehouseId());
if (!baseWareHouse.getWarehouseType().equals(WmsConstants.WMS_WAREHOUSE_TYPE_NORMAL)) {
throw new ServiceException("请选择人工仓库的库位进行移库");
}
//todo:判断有没有还没有完成从此原库位到目标库位的移库任务(预防还没修改库位状态生成此数据,连续点击问题,或者已经移库出库完成的情况不能将原库位再设置移库记录)
String warehouseInstockType = baseWareHouse.getWarehouseInstockType();
String warehouseType = baseWareHouse.getWarehouseType();
Date currentDate = new Date();
String userName = SecurityUtils.getUsername();
String warehouseInstockType = baseWareHouse.getWarehouseInstockType();
String moveWay = "", operationType = "";
if (warehouseType.equals(WmsConstants.WMS_WAREHOUSE_TYPE_WORKBIN_AGV)) {
throw new ServiceException("立库库位移库请在调度页面进行移库");
} else if (warehouseType.equals(WmsConstants.WMS_WAREHOUSE_TYPE_AGV)) {
moveWay = WmsConstants.WMS_MOVEMERGE_WAY_AGV;
operationType = WmsConstants.MWS_OPERATION_TYPE_DISPATCHD;
WmsMove queryMove = new WmsMove();
queryMove.setWarehouseId(oriLocation.getWarehouseId());
queryMove.setExecuteStatusStr(WmsConstants.WMS_EXECUTE_STATUS_TOEXECUTE + "," + WmsConstants.WMS_MOVE_EXECUTE_STATUS_EXECUTING + "," + WmsConstants.WMS_MOVE_EXECUTE_STATUS_OUTSTOCK_FINISH);
List<WmsMove> wmsMoveList = wmsMoveMapper.selectWmsMoveList(queryMove);
if (wmsMoveList != null && !wmsMoveList.isEmpty()) {
throw new ServiceException("有正在执行的移库任务");
}
} else {
moveWay = WmsConstants.WMS_MOVEMERGE_WAY_MANUAL;
operationType = WmsConstants.WMS_OPERATION_TYPE_MANUAL;
oriLocation.setLocationStatus(WmsConstants.WMS_BASE_LOCATION_STATUS_MOVE_LOCK);
oriLocation.setUpdateTime(currentDate);
oriLocation.setUpdateBy(userName);
wmsBaseLocationMapper.updateWmsBaseLocation(oriLocation);
targetLocation.setLocationStatus(WmsConstants.WMS_BASE_LOCATION_STATUS_MOVE_LOCK);
targetLocation.setUpdateTime(currentDate);
targetLocation.setUpdateBy(userName);
wmsBaseLocationMapper.updateWmsBaseLocation(targetLocation);
}
WmsMove wmsMove = new WmsMove();
String taskCode = Seq.getId(Seq.wmsMoveSeqType, Seq.wmsMoveSeqCode);
@ -201,8 +227,8 @@ public class WmsMoveServiceImpl implements IWmsMoveService {
wmsMove.setOriLocationCode(wmsMoveApplyVo.getOriLocationCode());
wmsMove.setTargetLocationCode(wmsMoveApplyVo.getTargetLocationCode());
wmsMove.setExecuteStatus(WmsConstants.WMS_MOVE_EXECUTE_STATUS_TOEXECUTE);
wmsMove.setOperationType(WmsConstants.WMS_OPERATION_TYPE_MANUAL);
wmsMove.setMoveWay(WmsConstants.WMS_MOVEMERGE_WAY_MANUAL);
wmsMove.setOperationType(operationType);
wmsMove.setMoveWay(moveWay);
wmsMove.setMoveType(wmsMoveApplyVo.getMoveType());
wmsMove.setAuditStatus(WmsConstants.WMS_AUDIT_STATUS_PASS);
wmsMove.setExecuteStatus(WmsConstants.WMS_EXECUTE_STATUS_TOEXECUTE);
@ -213,6 +239,8 @@ public class WmsMoveServiceImpl implements IWmsMoveService {
List<WmsMoveDetail> toInsertedMoveDetails = new ArrayList<>();
//判断库位状态,如果原库位和目标库位是深库位,需要判断浅库位状态,需要判断对应的浅库位有没有库存
if (warehouseInstockType.equals(WmsConstants.WMS_WAREHOUSE_INSTOCK_TYPE_RAW)) {//如果是原材料
WmsRawStock queryRawStock = new WmsRawStock();
queryRawStock.setLocationCode(oriLocationCode);
@ -268,21 +296,70 @@ public class WmsMoveServiceImpl implements IWmsMoveService {
toInsertedMoveDetails = getMoveDetailsByProductStocks(productStocks, wmsMove, userName, currentDate);
}
oriLocation.setLocationStatus(WmsConstants.WMS_BASE_LOCATION_STATUS_MOVE_LOCK);
oriLocation.setUpdateTime(currentDate);
oriLocation.setUpdateBy(userName);
wmsBaseLocationMapper.updateWmsBaseLocation(oriLocation);
if (warehouseType.equals(WmsConstants.WMS_WAREHOUSE_TYPE_NORMAL)) {
wmsMoveMapper.batchWmsMoveDetail(toInsertedMoveDetails);
} else if (warehouseType.equals(WmsConstants.WMS_WAREHOUSE_TYPE_AGV)) {
this.checkFrontLocationStock(oriLocation, warehouseInstockType, "1");
this.checkFrontLocationStock(targetLocation, warehouseInstockType, "2");
}
targetLocation.setLocationStatus(WmsConstants.WMS_BASE_LOCATION_STATUS_MOVE_LOCK);
targetLocation.setUpdateTime(currentDate);
targetLocation.setUpdateBy(userName);
wmsBaseLocationMapper.updateWmsBaseLocation(targetLocation);
int rows = wmsMoveMapper.batchWmsMoveDetail(toInsertedMoveDetails);
return rows;
return 1;
}
private void checkFrontLocationStock(WmsBaseLocation baseLocation, String warehouseInstockType, String moveType) {
if (baseLocation.getLocDeep() != null && baseLocation.getLocDeep().equals(WmsConstants.WMS_BASE_LOCATION_LOC_DEEP_BACK)) {
WmsBaseLocation queryBaseLocation = new WmsBaseLocation();
Long locRow = baseLocation.getLocRow();
Long frontRow;
if (locRow % 2 == 0) {
frontRow = locRow - 1;
} else {
frontRow = locRow + 1;
}
queryBaseLocation.setWarehouseId(baseLocation.getWarehouseId());
queryBaseLocation.setLocColumn(baseLocation.getLocColumn());
queryBaseLocation.setLayerNum(baseLocation.getLayerNum());
queryBaseLocation.setLocRow(frontRow);
queryBaseLocation.setLocDeep(WmsConstants.WMS_BASE_LOCATION_LOC_DEEP_FRONT);
List<WmsBaseLocation> baseLocationList = wmsBaseLocationMapper.selectWmsBaseLocationList(queryBaseLocation);
String locationName = "";
if (moveType.equals("1")) {
locationName = "原库位";
} else {
locationName = "目标库位";
}
if (baseLocationList == null || baseLocationList.isEmpty()) {
throw new ServiceException(locationName + "的浅库位未找到");
}
WmsBaseLocation frontLocation = baseLocationList.get(0);
if (!frontLocation.getLocationStatus().equals(WmsConstants.WMS_BASE_LOCATION_STATUS_NORMAL)) {
throw new ServiceException(locationName + "的浅库位状态为" + WmsConstants.LOCATION_STATUS_PROMPT_MAP.get(frontLocation.getLocationStatus()));
}
if (warehouseInstockType.equals(WmsConstants.WMS_WAREHOUSE_INSTOCK_TYPE_RAW)) {//如果是原材料
WmsRawStock queryRawStock = new WmsRawStock();
queryRawStock.setLocationCode(frontLocation.getLocationCode());
List<WmsRawStock> wmsRawStocks = wmsRawStockMapper.selectWmsRawStockInList(queryRawStock);
if (wmsRawStocks != null && !wmsRawStocks.isEmpty()) {
throw new ServiceException(locationName + "的浅库位有库存,无法申请移库");
}
} else {
WmsProductStock queryProductStock = new WmsProductStock();
queryProductStock.setLocationCode(frontLocation.getLocationCode());
List<WmsProductStock> productStocks = wmsProductStockMapper.selectWmsProductStockInList(queryProductStock);
if (productStocks != null && !productStocks.isEmpty()) {
throw new ServiceException(locationName + "的浅库位有库存,无法申请移库");
}
}
}
}
private List<WmsMoveDetail> getMoveDetailsByRawStocks(List<WmsRawStock> wmsRawStocks, WmsMove wmsMove,
String userName, Date currentDate) {
List<WmsMoveDetail> wmsMoveDetailList = new ArrayList<>();
@ -718,12 +795,31 @@ public class WmsMoveServiceImpl implements IWmsMoveService {
throw new ServiceException("没有此移库信息");
}
//根据物料ID找移库明细主要原因是移库入库的库位的物料条码跟之前的条码不一定一样物料条码都是贴在料框上的
WmsMoveDetail existedMoveDetail = wmsMoveDetailList.stream().filter(moveDetail ->
moveDetail.getMaterialBarcode().equals(materialBarcode)).findFirst().get();
moveDetail.getMaterialId().equals(baseBarcodeInfo.getMaterialId())).findFirst().get();
if (existedMoveDetail == null) {
throw new ServiceException("没有此移库信息");
}
String oriBarcodeInfoStr = existedMoveDetail.getMaterialBarcode();
R<MesBaseBarcodeInfo> oriBarcodeInfoR = remoteMesService.getBarcode(oriBarcodeInfoStr, SecurityConstants.INNER);
MesBaseBarcodeInfo oriBarcodeInfo = oriBarcodeInfoR.getData();
if (oriBarcodeInfo == null) {
throw new ServiceException("原物料条码有误");
}
Long targetPurchaseOrderId = baseBarcodeInfo.getPurchaseOrderId() == null ? 0L : baseBarcodeInfo.getPurchaseOrderId();
Long oriPurchaseOrderId = oriBarcodeInfo.getPurchaseOrderId() == null ? 0L : oriBarcodeInfo.getPurchaseOrderId();
if (!targetPurchaseOrderId.equals(oriPurchaseOrderId)) {
String targetPoNo = baseBarcodeInfo.getPoNo() == null ? "" : baseBarcodeInfo.getPoNo();
String oriPoNo = oriBarcodeInfo.getPoNo() == null ? "" : oriBarcodeInfo.getPoNo();
throw new ServiceException("原物料条码(" + oriPoNo + ")和此条码采购订单(" + targetPoNo + ")不一致");
}
String detailExecuteStatus = existedMoveDetail.getExecuteStatus();
if (detailExecuteStatus.equals(WmsConstants.WMS_MOVE_EXECUTE_STATUS_INSTOCK_FINISH)) {
@ -856,7 +952,6 @@ public class WmsMoveServiceImpl implements IWmsMoveService {
}
/**
* ,Join material
*

@ -163,6 +163,10 @@ public class WmsRawInstockServiceImpl implements IWmsRawInstockService {
throw new ServiceException("库位编码有误");
}
if(!baseLocation.getLocationStatus().equals(WmsConstants.WMS_BASE_LOCATION_STATUS_NORMAL)){
throw new ServiceException("不能入库,库位状态为:"+WmsConstants.LOCATION_STATUS_PROMPT_MAP.get(baseLocation.getLocationStatus()));
}
BigDecimal instockAmount = wmsRawInstockVo.getInstockAmount();
if (baseBarcodeInfo.getBatchFlag().equals(MesConstants.IS_BATCH)) {
if (instockAmount.compareTo(BigDecimal.ONE) < 0) {

@ -328,10 +328,25 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
throw new ServiceException("库位码有误");
}
if (!baseLocation.getLocationStatus().equals(WmsConstants.WMS_BASE_LOCATION_STATUS_NORMAL)) {
throw new ServiceException("不能出库,库位状态为:" + WmsConstants.LOCATION_STATUS_PROMPT_MAP.get(baseLocation.getLocationStatus()));
}
//判断是否有此出库任务,人工出库的同一个出库记录同一个库位、同一个物料对应一个明细agv的有可能是多个
WmsRawOutstock wmsRawOutstock;
if (rawOutstockId != null) {
wmsRawOutstock = wmsRawOutstockMapper.selectWmsRawOutstockByRawOutstockId(rawOutstockId);
if (!wmsRawOutstock.getWarehouseId().equals(baseLocation.getWarehouseId())) {
throw new ServiceException("扫描库位所在仓库与选择出库单不符合");
}
if (!wmsRawOutstock.getMaterialId().equals(baseBarcodeInfo.getMaterialId())) {
throw new ServiceException("扫描物料与选择出库单不符合");
}
if (wmsRawOutstock.getExecuteStatus().equals(WmsConstants.WMS_EXECUTE_STATUS_FINISH)) {
throw new ServiceException("此出库单已出库完成,不需要再出");
}
} else {
wmsRawOutstock = this.getWmsRawOutstock(baseLocation, baseBarcodeInfo);
}
@ -346,7 +361,6 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
throw new ServiceException("此物料已经出库,不能重复出库");
}
//todo 判断质检状态
// if (wmsRawOutstockDetail.getQualityStatus() != null
// && !wmsRawOutstockDetail.getQualityStatus().equals(WmsConstants.WMS_QUALITY_STATUS_PASS)) {
// throw new ServiceException("质检通过才能出库");
@ -466,6 +480,8 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
@Override
public List<WmsRawOutstock> selectAuditPassRawOutstocks(WmsRawOutstock wmsRawOutstock) {
wmsRawOutstock.setAuditStatus(WmsConstants.WMS_AUDIT_STATUS_PASS);
wmsRawOutstock.setExecuteStatusStr(WmsConstants.WMS_EXECUTE_STATUS_TOEXECUTE + "," + WmsConstants.WMS_EXECUTE_STATUS_EXECUTING);
wmsRawOutstock.setOperationType(WmsConstants.WMS_OPERATION_TYPE_MANUAL);
List<WmsRawOutstock> wmsRawOutstocks = wmsRawOutstockMapper.selectWmsRawOutstockJoinMaterialList(wmsRawOutstock);
return wmsRawOutstocks;
}
@ -1243,7 +1259,7 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
public BigDecimal directOutstockUpdateRawStock(String locationCode, String materialBarcode, BigDecimal outstockAmount,
String userName, Date currentDate) {
String userName, Date currentDate) {
WmsRawStock wmsRawStock = wmsRawStockMapper.selectRawStockByBarcode(materialBarcode);
if (wmsRawStock == null) {
throw new ServiceException("没找到库存信息");
@ -1313,4 +1329,113 @@ public class WmsRawOutstockServiceImpl implements IWmsRawOutstockService {
wmsRawOutstock.setTaskType(WmsConstants.WMS_RAW_OUTSTOCK_TASK_TYPE_PRODUCTION_SPLIT);
return wmsRawOutstockMapper.selectNewestWmsRawOutstock(wmsRawOutstock);
}
/**
* 退
*
* @param wmsReturnOutstockVo
* @return
*/
@Transactional(rollbackFor = Exception.class)
@Override
public int returnOutstock(WmsReturnOutstockVo wmsReturnOutstockVo) {
String locationCode = wmsReturnOutstockVo.getLocationCode();
WmsBaseLocation baseLocation = wmsBaseLocationMapper.selectWmsBaseLocationByLocationCode(locationCode);
if (baseLocation == null) {
throw new ServiceException("库位编码错误");
}
Date currentDate = new Date();
String userName = SecurityUtils.getUsername();
WmsBaseWarehouse baseWarehouse = wmsBaseWarehouseMapper.selectWmsBaseWarehouseByWarehouseId(baseLocation.getWarehouseId());
if (!baseWarehouse.getWarehouseInstockType().equals(WmsConstants.WMS_WAREHOUSE_INSTOCK_TYPE_RAW)) {
throw new ServiceException("原材料仓库才能退货出库");
}
String warehouseType = baseWarehouse.getWarehouseType();
String executeStatus = "";
BigDecimal outstockAmount = BigDecimal.ZERO;
BigDecimal realOutstockAmount = BigDecimal.ZERO;
WmsRawStock wmsRawStock;
if (warehouseType.equals(WmsConstants.WMS_WAREHOUSE_TYPE_AGV)) {//AGV仓库
executeStatus = WmsConstants.WMS_EXECUTE_STATUS_TOEXECUTE;
outstockAmount = BigDecimal.ONE;
WmsRawStock queryRawStock = new WmsRawStock();
queryRawStock.setLocationCode(locationCode);
List<WmsRawStock> wmsRawStocks = wmsRawStockMapper.selectWmsRawStockInList(queryRawStock);
if (wmsRawStocks == null || wmsRawStocks.isEmpty()) {
throw new ServiceException("此库位无库存信息");
}
if (baseLocation.getLocationStatus().equals(WmsConstants.WMS_BASE_LOCATION_STATUS_RETURN_LOCK)) {
throw new ServiceException("此库位已经申请退货出库");
}
baseLocation.setLocationStatus(WmsConstants.WMS_BASE_LOCATION_STATUS_RETURN_LOCK);
baseLocation.setUpdateBy(userName);
baseLocation.setUpdateTime(currentDate);
wmsBaseLocationMapper.updateWmsBaseLocation(baseLocation);
wmsRawStock = wmsRawStocks.get(0);
} else if (warehouseType.equals(WmsConstants.WMS_WAREHOUSE_TYPE_NORMAL)) {
executeStatus = WmsConstants.WMS_EXECUTE_STATUS_FINISH;
String materialBarcode = wmsReturnOutstockVo.getMaterialBarcode();
BigDecimal returnAmount = wmsReturnOutstockVo.getReturnAmount();
outstockAmount = returnAmount;
realOutstockAmount = returnAmount;
if (StringUtils.isEmpty(materialBarcode)) {
throw new ServiceException("请输入或扫描物料条码");
}
if (returnAmount == null) {
throw new ServiceException("请输入退货数量");
}
wmsRawStock = wmsRawStockMapper.selectRawStockByBarcode(materialBarcode);
if (wmsRawStock == null) {
throw new ServiceException("无库存信息");
}
BigDecimal totalAmount = wmsRawStock.getTotalAmount();
BigDecimal occupyAmount = wmsRawStock.getOccupyAmount() == null ? BigDecimal.ZERO : wmsRawStock.getOccupyAmount();
BigDecimal availableAmount = totalAmount.subtract(occupyAmount);
if (returnAmount.compareTo(availableAmount) > 0) {
throw new ServiceException("可用库存只有:" + availableAmount);
}
if (returnAmount.compareTo(totalAmount) == 0) {
wmsRawStockMapper.deleteWmsRawStockByRawStockId(wmsRawStock.getRawStockId());
} else {
wmsRawStock.setTotalAmount(totalAmount.subtract(returnAmount));
wmsRawStock.setUpdateBy(userName);
wmsRawStock.setUpdateDate(currentDate);
wmsRawStockMapper.updateWmsRawStock(wmsRawStock);
}
} else {
throw new ServiceException("仓库类型有误");
}
String operationType = WmsConstants.OPERATION_TYPE_MAP.get(warehouseType);
WmsRawOutstock wmsRawOutstock = new WmsRawOutstock();
wmsRawOutstock.setTaskCode(Seq.getId(Seq.rawOutstockSeqType, Seq.rawOutstockSeqCode));
wmsRawOutstock.setWarehouseId(baseWarehouse.getWarehouseId());
wmsRawOutstock.setLocationCode(locationCode);
wmsRawOutstock.setSaleOrderId(wmsRawStock.getSaleOrderId());
wmsRawOutstock.setMaterialId(wmsRawStock.getMaterialId());
wmsRawOutstock.setMaterialBatch(wmsRawStock.getInstockBatch());
wmsRawOutstock.setOutstockAmount(outstockAmount);
wmsRawOutstock.setRealOutstockAmount(realOutstockAmount);
wmsRawOutstock.setOperationType(operationType);
wmsRawOutstock.setAuditStatus(WmsConstants.WMS_AUDIT_STATUS_PASS);
wmsRawOutstock.setExecuteStatus(executeStatus);
wmsRawOutstock.setTaskType(WmsConstants.WMS_RAW_OUTSTOCK_TASK_TYPE_RETURN_OUTSTOCK);
wmsRawOutstock.setApplyBy(userName);
wmsRawOutstock.setApplyDate(currentDate);
return wmsRawOutstockMapper.insertWmsRawOutstock(wmsRawOutstock);
}
}

@ -276,7 +276,6 @@ public class WmsRawReturnServiceImpl implements IWmsRawReturnService {
BigDecimal returnAmount = wmsRawReturnConfirmVo.getReturnAmount();
String locationCode = wmsRawReturnConfirmVo.getLocationCode();
//todo: 判断质检状态,超出库位数量限制,超期判断
// if (wmsRawReturnDetail.getQualityStatus() != null
// && !wmsRawReturnDetail.getQualityStatus().equals(WmsConstants.RAW_RETURN_DETAIL_QUALITY_STATUS_PASS)) {
// throw new ServiceException("质检通过才能出库");
@ -288,11 +287,11 @@ public class WmsRawReturnServiceImpl implements IWmsRawReturnService {
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("物料码错误");
}
WmsRawReturn wmsRawReturn = wmsRawReturnMapper.selectOnlyWmsRawReturnByRawReturnId(rawReturnId);
if (!wmsRawReturn.getAuditStatus().equals(WmsConstants.WMS_AUDIT_STATUS_PASS)) {
@ -311,13 +310,10 @@ public class WmsRawReturnServiceImpl implements IWmsRawReturnService {
// }
// }
if (!wmsRawReturn.getMaterialBarcode().equals(materialBarcode)) {
throw new ServiceException("物料编码错误");
}
WmsBaseLocation baseLocation = wmsBaseLocationMapper.selectWmsBaseLocationByLocationCode(locationCode);
if (baseLocation == null) {
throw new ServiceException("库位编码有误");
throw new ServiceException("库位编码有误");
}
if (!baseLocation.getWarehouseId().equals(wmsRawReturn.getWarehouseId())) {
@ -397,7 +393,6 @@ public class WmsRawReturnServiceImpl implements IWmsRawReturnService {
wmsRawStock.setLastOutstockTime(mesBaseBarcodeInfo.getLastOutstockDate());
wmsRawStock.setSaleOrderId(mesBaseBarcodeInfo.getSaleOrderId());
wmsRawStock.setSafeFlag(mesBaseBarcodeInfo.getSafeFlag());
// wmsRawStock.setQualityStatus();//TODO:质检状态
wmsRawStock.setCompleteFlag(WmsConstants.WMS_RAW_STOCK_COMPLETE_FLAG_YES);
wmsRawStock.setTotalAmount(wmsRawReturnConfirmVo.getReturnAmount());
wmsRawStock.setCreateBy(userName);

@ -5,6 +5,7 @@ import java.util.*;
import java.util.stream.Collectors;
import com.alibaba.fastjson2.JSONObject;
import com.hw.common.core.constant.Constants;
import com.hw.common.core.constant.MesConstants;
import com.hw.common.core.constant.SecurityConstants;
import com.hw.common.core.constant.WmsConstants;
@ -16,6 +17,8 @@ import com.hw.mes.api.RemoteMesService;
import com.hw.mes.api.domain.MesBaseBarcodeInfo;
import com.hw.mes.api.domain.MesBaseMaterialInfo;
import com.hw.mes.api.domain.MesBaseStationInfo;
import com.hw.mes.api.domain.MesSaleOrderRelate;
import com.hw.mes.api.domain.vo.MesBaseBarcodeInfoTransferVo;
import com.hw.mes.api.domain.vo.MesSaleOrderTransferVo;
import com.hw.wms.config.WmsConfig;
import com.hw.wms.domain.WmsBaseLocation;
@ -159,7 +162,7 @@ public class WmsStockTotalServiceImpl implements IWmsStockTotalService {
wmsStockTotal.setMaterialId(wmsStockTotal.getProductId());
wmsStockTotal.setAccessoriesFlag(null);
} else {
if (wmsStockTotal.getAccessoriesFlag().equals(MesConstants.MES_MATERIAL_ACCESSORIES_FLAG_NO)) {
if (StringUtils.isEmpty(wmsStockTotal.getAccessoriesFlag()) || wmsStockTotal.getAccessoriesFlag().equals(MesConstants.MES_MATERIAL_ACCESSORIES_FLAG_NO)) {
wmsStockTotal.setAncestors("0," + wmsStockTotal.getMaterialBomId());
wmsStockTotal.setAccessoriesFlag(null);
}
@ -222,10 +225,33 @@ public class WmsStockTotalServiceImpl implements IWmsStockTotalService {
throw new ServiceException("没有销售订单成品库存信息");
}
for(WmsStockTotal stockTotal:stockTotalList){
if(stockTotal.getProductId().equals(0L)){
stockTotal.setMaterialCode("1111|222");
for (WmsStockTotal stockTotal : stockTotalList) {
if (stockTotal.getMaterialClassfication() != null &&
stockTotal.getMaterialClassfication().equals(MesConstants.MES_MATERIAL_CLASSFICATION_VIRTUAL)) {
R<List<MesSaleOrderRelate>> saleOrderRelatesData = remoteMesService.getRelateProductsBySaleOrderId(stockTotal.getSaleOrderId(), SecurityConstants.INNER);
if (saleOrderRelatesData != null) {
StringBuilder productCodes = new StringBuilder();
StringBuilder productNames = new StringBuilder();
StringBuilder productSpecs = new StringBuilder();
List<MesSaleOrderRelate> saleOrderRelates = saleOrderRelatesData.getData();
if (saleOrderRelates != null) {
for (MesSaleOrderRelate mesSaleOrderRelate : saleOrderRelates) {
productCodes.append("|").append(mesSaleOrderRelate.getProductCode());
productNames.append("|").append(mesSaleOrderRelate.getProductName());
productSpecs.append("|").append(mesSaleOrderRelate.getProductSpec());
}
productCodes.replace(0,1,"");
productNames.replace(0, 1, "");
productSpecs.replace(0, 1, "");
stockTotal.setMaterialCode(productCodes.toString());
stockTotal.setMaterialName(productNames.toString());
stockTotal.setMaterialSpec(productSpecs.toString());
}
}
}
}
return stockTotalList;
@ -439,21 +465,21 @@ public class WmsStockTotalServiceImpl implements IWmsStockTotalService {
throw new ServiceException("没有可转库存明细");
}
if (wmsProductStocks.size() < transferAmount.intValue()) {
throw new ServiceException("可转库存明细数量为%s", wmsProductStocks.size());
throw new ServiceException("可转库存明细数量为" + wmsProductStocks.size());
}
List<MesBaseBarcodeInfo> mesBaseBarcodeInfos = new ArrayList<>();
List<MesBaseBarcodeInfoTransferVo> mesBaseBarcodeInfoTransferVos = new ArrayList<>();
for (WmsProductStock wmsProductStock : wmsProductStocks) {
MesBaseBarcodeInfo mesBaseBarcodeInfo = new MesBaseBarcodeInfo();
mesBaseBarcodeInfo.setSaleOrderId(saleOrderId);
mesBaseBarcodeInfo.setSaleorderCode(saleorderCode);
mesBaseBarcodeInfo.setSafeFlag(safeFlag);
mesBaseBarcodeInfo.setBarcodeInfo(wmsProductStock.getProductBatch());
mesBaseBarcodeInfos.add(mesBaseBarcodeInfo);
MesBaseBarcodeInfoTransferVo mesBaseBarcodeInfoTransferVo = new MesBaseBarcodeInfoTransferVo();
mesBaseBarcodeInfoTransferVo.setSaleOrderId(saleOrderId);
mesBaseBarcodeInfoTransferVo.setSaleOrderCode(saleorderCode);
mesBaseBarcodeInfoTransferVo.setSafeFlag(safeFlag);
mesBaseBarcodeInfoTransferVo.setBarcodeInfo(wmsProductStock.getProductBatch());
mesBaseBarcodeInfoTransferVos.add(mesBaseBarcodeInfoTransferVo);
wmsProductStock.setSafeFlag(safeFlag);
wmsProductStock.setSaleOrderId(saleOrderId);
wmsProductStock.setSaleorderCode(saleorderCode);
wmsProductStock.setSaleorderCode(saleorderCode == null ? "" : saleorderCode);
wmsProductStock.setUpdateDate(new Date());
wmsProductStock.setUpdateBy(SecurityUtils.getUsername());
wmsProductStockMapper.updateWmsProductStock(wmsProductStock);
@ -464,13 +490,19 @@ public class WmsStockTotalServiceImpl implements IWmsStockTotalService {
mesSaleOrderTransferVo.setOldSaleOrderId(wmsStockTotal.getSaleOrderId());
mesSaleOrderTransferVo.setNewSaleOrderId(saleOrderId);
mesSaleOrderTransferVo.setMaterialId(materialId);
mesSaleOrderTransferVo.setMesBaseBarcodeInfos(mesBaseBarcodeInfos);
mesSaleOrderTransferVo.setMesBaseBarcodeInfoTransferVos(mesBaseBarcodeInfoTransferVos);
R<Boolean> transferBaseBarcodeInfosResult = remoteMesService.transferSaleOrders(mesSaleOrderTransferVo, SecurityConstants.INNER);
if (!transferBaseBarcodeInfosResult.getData()) {
throw new RuntimeException("销售订单信息转换失败");
System.out.println(mesSaleOrderTransferVo.toString());
R<?> transferBaseBarcodeInfosResult = remoteMesService.transferSaleOrders(mesSaleOrderTransferVo, SecurityConstants.INNER);
if (transferBaseBarcodeInfosResult.getCode() != Constants.SUCCESS) {//抛出异常,回滚事务
throw new RuntimeException(transferBaseBarcodeInfosResult.getMsg());
}
// if (!transferBaseBarcodeInfosResult.getData()) {
// throw new RuntimeException("销售订单信息转换失败");
// }
return 1;
}

@ -45,7 +45,7 @@
</resultMap>
<sql id="selectWmsBaseLocationVo">
select location_id, warehouse_id, location_code,container_code,agv_position_code, warehouse_floor,loc_row, layer_num, loc_column, active_flag, manual_flag, qty_limit, instock_flag, outstock_flag, location_status, batch_mix, create_by, create_time, update_by, update_time, remark, del_flag, shelf_order, check_order, pick_order, pick_flag, is_open_kn_flag, location_scrap_type, volume_limit, weight_limit, length, width, height from wms_base_location
select location_id, warehouse_id, location_code,container_code,agv_position_code, warehouse_floor,loc_row, layer_num, loc_column, active_flag, manual_flag, qty_limit, instock_flag, outstock_flag, location_status,loc_deep, batch_mix, create_by, create_time, update_by, update_time, remark, del_flag, shelf_order, check_order, pick_order, pick_flag, is_open_kn_flag, location_scrap_type, volume_limit, weight_limit, length, width, height from wms_base_location
</sql>
<select id="selectWmsBaseLocationList" parameterType="WmsBaseLocation" resultMap="WmsBaseLocationResult">

@ -9,6 +9,7 @@
<result property="inventoryCheckCode" column="inventory_check_code" />
<result property="warehouseId" column="warehouse_id" />
<result property="checkStatus" column="check_status" />
<result property="checkType" column="check_type" />
<result property="beginTime" column="begin_time" />
<result property="endTime" column="end_time" />
<result property="locationAmount" column="location_amount" />
@ -84,6 +85,7 @@
<if test="inventoryCheckCode != null">inventory_check_code,</if>
<if test="warehouseId != null">warehouse_id,</if>
<if test="checkStatus != null and checkStatus != ''">check_status,</if>
<if test="checkType != null and checkType != ''">check_type,</if>
<if test="beginTime != null">begin_time,</if>
<if test="endTime != null">end_time,</if>
<if test="locationAmount != null">location_amount,</if>
@ -99,6 +101,7 @@
<if test="inventoryCheckCode != null">#{inventoryCheckCode},</if>
<if test="warehouseId != null">#{warehouseId},</if>
<if test="checkStatus != null and checkStatus != ''">#{checkStatus},</if>
<if test="checkType != null and checkType != ''">#{checkType},</if>
<if test="beginTime != null">#{beginTime},</if>
<if test="endTime != null">#{endTime},</if>
<if test="locationAmount != null">#{locationAmount},</if>
@ -175,6 +178,7 @@
<if test="inventoryCheckCode != null and inventoryCheckCode != ''"> and wic.inventory_check_code = #{inventoryCheckCode}</if>
<if test="warehouseId != null "> and wic.warehouse_id = #{warehouseId}</if>
<if test="checkStatus != null and checkStatus != ''"> and wic.check_status = #{checkStatus}</if>
<if test="checkType != null and checkType != ''"> and wic.check_type = #{checkType}</if>
<if test="params.beginBeginTime != null and params.beginBeginTime != '' and params.endBeginTime != null and params.endBeginTime != ''">
and wic.begin_time between #{params.beginBeginTime} and #{params.endBeginTime}</if>

@ -81,6 +81,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="auditReason != null and auditReason != ''"> and audit_reason = #{auditReason}</if>
<if test="auditStatus != null and auditStatus != ''"> and audit_status = #{auditStatus}</if>
<if test="executeStatus != null and executeStatus != ''"> and execute_status = #{executeStatus}</if>
<if test="executeStatusStr != null and executeStatusStr != ''"> and execute_status in (${executeStatusStr})</if>
<if test="applyBy != null and applyBy != ''"> and apply_by = #{applyBy}</if>
<if test="applyDate != null "> and apply_date = #{applyDate}</if>
<if test="auditBy != null and auditBy != ''"> and audit_by = #{auditBy}</if>

@ -203,6 +203,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</where>
order by wri.apply_date desc
</select>
<select id="selectWmsRawInstockERPNotSynchronized" parameterType="WmsRawInstock" resultMap="WmsRawInstockResult">
select wri.raw_instock_id,

@ -273,6 +273,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="taskType != null and taskType != ''"> and wro.task_type = #{taskType}</if>
<if test="applyBy != null and applyBy != ''"> and wro.apply_by like concat('%', #{applyBy}, '%')</if>
</where>
order by wro.apply_date desc
</select>
<select id="selectWmsRawOutstockJoinList4Audit" parameterType="WmsRawOutstock" resultMap="WmsRawOutstockResult">
@ -305,6 +306,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="taskCode != null and taskCode != ''"> and wro.task_code = #{taskCode}</if>
<if test="auditStatus != null and auditStatus != ''"> and wro.audit_status = #{auditStatus}</if>
<if test="applyBy != null and applyBy != ''"> and wro.apply_by like concat('%', #{applyBy}, '%')</if>
<if test="executeStatusStr != null and executeStatusStr != ''"> and execute_status in (${executeStatusStr})</if>
<if test="operationType != null and operationType != ''"> and operation_type = #{operationType}</if>
</where>
order by wro.raw_outstock_id desc
</select>

@ -55,6 +55,7 @@
<result property="saleorderCode" column="saleorder_code"/>
<result property="orderAmount" column="order_amount"/>
<result property="applyAmount" column="apply_amount"/>
<result property="materialClassfication" column="material_classfication"/>
</resultMap>
@ -172,7 +173,7 @@
wst.total_amount, wst.frozen_amount, wst.occupy_amount,wst.safe_flag,wst.sale_order_id,
mbmi.material_code,mbmi.material_name,mbmi.material_spec,
(select sum(wro.outstock_amount) from wms_raw_outstock wro where wro.stock_total_id=wst.stock_total_id and
wro.plan_code=#{planCode} and wro.plan_detail_code=#{planDetailCode} and wro.audit_status!='2') outstock_amount
wro.plan_code=#{planCode} and wro.plan_detail_code=#{planDetailCode} and wro.audit_status!='2' and wro.execute_status!='2') outstock_amount
from wms_stock_total wst left join mes_base_material_info mbmi on wst.material_id = mbmi.material_id
<where>
@ -288,6 +289,7 @@
mbmi.material_code,
mbmi.material_name,
mbmi.material_spec,
mbmi.material_classfication,
wst.total_amount,
wst.frozen_amount,
wst.occupy_amount,

@ -65,11 +65,20 @@ export function addInternalBarcode(data) {
})
}
//根据原材料条码判断是否有半成品出库
export function checkSemiOutstock(query) {
//根据原材料条码判断是否有半成品出库
return request({
url: '/wms/api/checkSemiOutstock',
method: 'get',
params: query
})
}
// 打印成品条码
export function reprintBarcodes(barcodeIds) {
return request({
url: '/mes/api/reprintBarcodes/' + barcodeIds,
method: 'get'
})
}

@ -42,3 +42,13 @@ export function delMaterialinfo(materialId) {
method: 'delete'
})
}
// 查询物料类型列表
export function getMaterialTypes(query) {
return request({
url: '/mes/materialinfo/getMaterialTypes',
method: 'get',
params: query
})
}

@ -115,6 +115,16 @@
>
</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-printer"
@click="reprintBarcodes(scope.row)"
v-if="scope.row.printFlag ==='1' && scope.row.barcodeType !== BARCODE_TYPE.BIND_BARCODE"
>补打印
</el-button>
<el-popover
placement="top"
@ -277,9 +287,9 @@ import {
printBindBarcodes,
selectProductBarcodeInfoByBarcodeInfo,
addInternalBarcode, regenerateBarcode,
checkSemiOutstock
checkSemiOutstock,
reprintBarcodes
} from "@/api/board/barcode";
import {getMaterialInfoByMaterialId} from "@/api/board";
export default {
name: "Barcode",
@ -888,6 +898,23 @@ export default {
},
reprintBarcodes(row) {
this.loading = true;
const barcodeId = row.barcodeId;
const barcodeInfo = row.barcodeInfo;
this.$modal.confirm('请确认是否要补打印条码内容为"' + barcodeInfo + '"的数据项?').then(function () {
return reprintBarcodes(barcodeId);
}).then(() => {
this.getList();
this.$modal.msgSuccess("重新打印成功");
}).catch(() => {
}).finally(e => {
this.loading = false;
});
},
}
};
</script>

@ -231,7 +231,7 @@
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-if="scope.row.printFlag !==PRINT_FLAG.YES && scope.row.barcodeType === BARCODE_TYPE.RAW &&
scope.row.purchaseOrderId && scope.row.purchaseOrderId!==null && scope.row.purchaseOrderId > 0"
scope.row.purchaseOrderId && scope.row.purchaseOrderId!==null"
v-hasPermi="['mes:barcode:edit']"
>编辑
</el-button>
@ -1127,7 +1127,7 @@ export default {
if (filterSaleOrderIdMaterialRelateList != null && filterSaleOrderIdMaterialRelateList.length > 0) {
let errorMsg = "选择的信息跟已经选择的销售订单号明细相同.";
for (let ssoid of filterSaleOrderIdMaterialRelateList) {
errorMsg += "销售订单号:" + ssoid.saleOrderCode + ",成品编码:" + ssoid.productCode + ",成品名称:" + ssoid.productName + ",成品规格:" + ssoid.productSpec + ";";
errorMsg += "销售订单号:" + ssoid.relateSaleOrderCode + ",成品编码:" + ssoid.productCode + ",成品名称:" + ssoid.productName + ",成品规格:" + ssoid.productSpec + ";";
}
this.$modal.msgError(errorMsg);
@ -1160,7 +1160,7 @@ export default {
});
this.materialRelateForm.poNo = firstRowPoNo;
this.materialRelateForm.saleOrderCode = firstRowSaleOrderCode;
this.materialRelateForm.saleorderCode = firstRowSaleOrderCode;
this.purchaseOrderOpen = false;
})
@ -1257,8 +1257,9 @@ export default {
handlePrintBarcodes(row) {
this.loading = true;
const barcodeIds = row.barcodeId || this.ids;
if (barcodeIds == null || barcodeIds === '') {
if (barcodeIds == null || barcodeIds === '' || barcodeIds.length===0) {
this.$modal.msgWarning("请选择要打印的物料条码");
this.loading = false;
return;
}
@ -1307,7 +1308,7 @@ export default {
return reprintBarcodes(barcodeId);
}).then(() => {
this.getList();
this.$modal.msgSuccess("重新生成成功");
this.$modal.msgSuccess("重新打印成功");
}).catch(() => {
}).finally(e => {
this.loading = false;
@ -1789,6 +1790,7 @@ export default {
this.submitLoading = true;
if (this.materialRelateForm.mesSaleOrderRelateList.length <= 1) {
this.$modal.msgError("请选择至少2条采购信息");
this.submitLoading = false;
return;
}
if (this.materialRelateForm.barcodeId && this.materialRelateForm.barcodeId != '') {

@ -47,14 +47,18 @@
/>
</el-select>
</el-form-item>
<el-form-item label="物料类型" prop="materialTypeId">
<el-input
v-model="queryParams.materialTypeId"
placeholder="请输入物料类型"
clearable
@keyup.enter.native="handleQuery"
/>
<el-form-item label="常备物料标识" prop="alwaysFlag">
<el-select v-model="queryParams.alwaysFlag" placeholder="请选择常备物料标识" clearable>
<el-option
v-for="dict in dict.type.mes_material_bind_flag"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="自动出库标识" prop="autoOutstockFlag">
<el-select v-model="queryParams.autoOutstockFlag" placeholder="请选择自动出库标识" clearable>
<el-option
@ -218,6 +222,7 @@
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['mes:materialinfo:edit']"
v-if="scope.row.materialClassfication === MATERIAL_CLASSFICATION.ERP"
>修改
</el-button>
<!-- <el-button-->
@ -410,7 +415,8 @@ import {
getMaterialinfo,
delMaterialinfo,
addMaterialinfo,
updateMaterialinfo
updateMaterialinfo,
getMaterialTypes
} from "@/api/mes/materialinfo";
import {listBaseMaterialType} from "@//api/mes/baseMaterialType";
import Treeselect from "@riophae/vue-treeselect";
@ -493,6 +499,10 @@ export default {
// ],
},
currentStatus: '',
MATERIAL_CLASSFICATION:{
ERP:'1',
VIRTUAL:'2'
}
};
},
created() {

@ -1235,9 +1235,21 @@ export default {
handleMaterialUsage(row) {
this.materialUsageOpen = true;
this.materialUsageList = [];
this.loading = true;
//bom
let warehouseFloor = 0;
if(row.dispatchId === 2){
warehouseFloor = 3;
}else if(row.dispatchId === 3){
warehouseFloor = 4;
}else if(row.dispatchId === 4){
warehouseFloor = 5;
}
getMaterialUsages(row).then(response => {
let materialUsageList = response.data;
getStockTotalWithRawOutstocks({saleOrderId: row.saleOrderId}).then(response => {
//ID
getStockTotalWithRawOutstocks({saleOrderId: row.saleOrderId,warehouseFloor:warehouseFloor}).then(response => {
let stockMapJson = response.data;
let totalAmountMap = stockMapJson.totalAmountMap;
let occupyAmountMap = stockMapJson.occupyAmountMap;
@ -1248,10 +1260,16 @@ export default {
objA.totalAmount = totalAmountMap[objA.materialId];
objA.outstockAmount = outstockAmountMap[objA.materialId];
objA.occupyAmount = occupyAmountMap[objA.materialId];
objA.totalAmount = objA.totalAmount ? objA.totalAmount : 0;
objA.outstockAmount = objA.outstockAmount ? objA.outstockAmount : 0;
objA.occupyAmount = objA.occupyAmount ? objA.occupyAmount : 0;
objA.availableAmount = objA.totalAmount -objA.occupyAmount;
// return returnObj; //
});
this.loading = false;
this.materialUsageList = materialUsageList;
// console.log(this.materialUsageList)
})

@ -425,6 +425,11 @@ export default {
components: {
'apply-raw-outstock': applyRawOutstock,
},
provide() {
return {
closeRawOutstockDialog: this.closeRawOutstockDialog,
}
},
props: {
value: [String, Object, Array, Number],
// sop
@ -1408,10 +1413,18 @@ export default {
this.productPlanData.planId = row.planId;
this.productPlanData.dispatchAmount = row.dispatchAmount;
this.productPlanData.saleOrderId = this.form.saleOrderId;
this.productPlanData.materialBomId = this.form.materialBomId;
}
}
},
closeRawOutstockDialog() {
this.applyRawOutstockOpen = false;
},
},
mounted() {
}
}

@ -425,6 +425,7 @@ export default {
this.upload.open = false;
this.upload.isUploading = false;
this.$refs.upload.clearFiles();
// alert(JSON.stringify(response))
if(response.code === 200){
this.$modal.msgSuccess("导入成功");
this.getList();
@ -437,8 +438,10 @@ export default {
this.title = "查看采购申请单";
});
}else{
this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "导入结果", {dangerouslyUseHTMLString: true});
}
// this.$alert("<div style='overflow: auto;overflow-x: hidden;max-height: 70vh;padding: 10px 20px 0;'>" + response.msg + "</div>", "", {dangerouslyUseHTMLString: true});
},
//

@ -134,7 +134,7 @@
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['mes:purchaseOrder:bind']"
v-if="scope.row.alwaysFlag === ALWAYS_FLAG.NO && (scope.row.orderStatus === ORDER_STATUS.TO_PURCHASE || scope.row.orderStatus === ORDER_STATUS.PURCHASEING)"
v-if="scope.row.orderStatus === ORDER_STATUS.TO_PURCHASE || scope.row.orderStatus === ORDER_STATUS.PURCHASEING"
>绑定
</el-button>
</template>

@ -104,8 +104,8 @@
label-width="68px">
<el-form-item label="订单编号" prop="poNo">
<el-input
v-model="allocatePurchaseOrderQueryParams.poNo"
placeholder="请输入物料编码"
v-model="purchaseOrderQueryParams.poNo"
placeholder="请输入订单编号"
style="width:140px;"
clearable
@keyup.enter.native="handleAllocateMaterialQuery"

@ -124,6 +124,7 @@
<el-radio label="C">菜单</el-radio>
<el-radio label="F">按钮</el-radio>
<el-radio label="P">PDA</el-radio>
<el-radio label="W">WCS</el-radio>
</el-radio-group>
</el-form-item>
</el-col>

@ -98,6 +98,7 @@
<div style="text-align: center;margin-top: 30px">
<el-button type="primary" @click="submitForm"></el-button>
<el-button type="info" @click="closeParentDialog"></el-button>
</div>
</div>
@ -115,6 +116,7 @@ export default {
}
},
dicts: ['mes_safe_flag'],
inject: ['closeRawOutstockDialog'],
data() {
return {
//
@ -177,7 +179,8 @@ export default {
planId: this.defineData.planId,
planCode: this.defineData.planCode,
dispatchAmount : this.defineData.dispatchAmount,
saleOrderId:this.defineData.saleOrderId
saleOrderId:this.defineData.saleOrderId,
materialBomId:this.defineData.materialBomId
}
}
},
@ -201,6 +204,7 @@ export default {
this.queryParams.warehouseId = this.form.warehouseId;
this.queryParams.saleOrderId = this.form.saleOrderId;
this.queryParams.planCode = this.form.planCode;
this.queryParams.materialBomId = this.form.materialBomId;
this.queryParams.planDetailCode = "0";
getStockTotal(this.queryParams).then(e => {
this.total = e.total;
@ -276,13 +280,13 @@ export default {
this.form.taskType = "1";//
this.form.planDetailCode = "0";
applyRawOutstock(this.form).then(e => {
this.dialogVisible = false
this.$modal.msgSuccess("申请投料成功");
this.closeParentDialog()
})
},
closeDialog(){
closeParentDialog() {
this.closeRawOutstockDialog()
}
}

@ -181,21 +181,6 @@
<el-col :span="20" :offset="4" :xs="20">
<el-divider content-position="center">库位库存明细信息</el-divider>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-shopping-cart-1"
size="mini"
@click="handleTransfer"
v-hasPermi="['wms:stocktotal:transfer']"
v-if="type === STOCK_TYPE.RAW"
>转库存
</el-button>
</el-col>
</el-row>
<el-table v-loading="loadingTwo" :data="rawstockList" @selection-change="handleRawStockSelectionChange">
<!-- <el-table-column label="原材料库存ID" align="center" prop="rawStockId" />-->
@ -235,6 +220,23 @@
<dict-tag :options="dict.type.wms_stock_complete_flag" :value="scope.row.completeFlag"/>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-shopping-cart-1"
v-if="type === STOCK_TYPE.RAW && scope.row.instockBatch.indexOf(RAW_BARCODE_VIRTUAL.EXTERNAL_VIRTUAL) < 0 && scope.row.instockBatch.indexOf(RAW_BARCODE_VIRTUAL.INTERNAL_VIRTUAL)<0"
@click="handleTransfer(scope.row)"
v-hasPermi="['wms:stocktotal:transfer']"
>转库存
</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="twoPTotal>0"
@ -269,7 +271,7 @@
</el-form-item>
<el-form-item label="待转数量" prop="transferAmount" v-if="this.transferType==='1'">
<el-input-number v-model="form.transferAmount" placeholder="请输入待转库存数量"/>
<el-input-number v-model="form.transferAmount" :min="1" step="1" placeholder="请输入待转库存数量"/>
</el-form-item>
@ -283,7 +285,7 @@
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button type="primary" :loading="submitLoading" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
@ -298,14 +300,13 @@
</el-dialog>
<el-dialog title="物料明细" :visible.sync="materialListOpen" width="560px" append-to-body>
<el-table :data="materialList">
<el-table :data="materialList">
<el-table-column label="序号" type="index" align="center"/>
<el-table-column label="物料编码" align="center" prop="materialCode" />
<el-table-column label="物料名称" align="center" prop="materialName" />
<el-table-column label="物料规格" align="center" prop="materialSpec" />
<el-table-column label="物料编码" align="center" prop="materialCode"/>
<el-table-column label="物料名称" align="center" prop="materialName"/>
<el-table-column label="物料规格" align="center" prop="materialSpec"/>
</el-table>
@ -436,15 +437,15 @@ export default {
VIRTUAL: "2"
},
RAW_BARCODE_VIRTUAL:{
EXTERNAL_VIRTUAL:"VR",//
INTERNAL_VIRTUAL:"RN",//
RAW_BARCODE_VIRTUAL: {
EXTERNAL_VIRTUAL: "VR",//
INTERNAL_VIRTUAL: "RN",//
},
selectSaleOrderVisible: false,
materialListOpen : false,
materialList:[]
submitLoading:false,
materialListOpen: false,
materialList: []
};
},
watch: {
@ -637,10 +638,9 @@ export default {
//
handleRawStockSelectionChange(selection) {
return;
let index = 0;
selection.forEach(row => {
index = this.rawstockList.indexOf(row);
index = this.rawstockList.indexOf(row);
});
this.instockBatches = selection.map((item, index1) => index + "-" + item.instockBatch);
this.rawStockIds = selection.map((item, index1) => index + "-" + item.rawStockId);
@ -649,13 +649,25 @@ export default {
this.multiple = !selection.length
},
handleTransfer() {
handleTransfer(row) {
this.reset();
this.transferType = "2";
this.rawStockInfosStr = this.rawStockInfos.join("<br>");
let index = this.rawstockList.indexOf(row)
this.form.instockBatch = row.instockBatch
this.form.rawStockId = row.rawStockId
this.form.indexStockIds =[index + "-" + row.rawStockId];
this.form.index = index;
this.rawStockInfosStr = "序号:" + (index + 1) + ",物料编码:" + row.materialCode + " 物料名称:" + row.materialName + " 物料规格:" + row.materialSpec + " 数量:" + row.totalAmount + " 销售订单:" + (row.saleorderCode ? row.saleorderCode : "无");
this.open = true;
},
// handleTransfer() {
// this.reset();
// this.transferType = "2";
// this.rawStockInfosStr = this.rawStockInfos.join("<br>");
// this.open = true;
// },
handleSaleOrderSelect() {
this.selectSaleOrderVisible = true;
},
@ -663,7 +675,8 @@ export default {
/** 提交选择销售订单按钮 */
submitSelectSaleOrderForm() {
let selectedRow = this.$refs.selectSaleOrderRef.selectedRow;
if(selectedRow.materialId!==this.form.materialId){
//
if (this.type === this.STOCK_TYPE.PRODUCT && selectedRow.materialId !== this.form.materialId) {
this.$modal.msgWarning("请选择相同物料的销售订单");
return;
}
@ -675,36 +688,60 @@ export default {
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
this.submitLoading = true;
if (this.form.safeFlag === this.SAFE_FLAG.YES) {
this.form.saleOrderId = 0;
this.form.saleorderCode = null;
}
if (this.type === this.STOCK_TYPE.PRODUCT) {
if (this.type === this.STOCK_TYPE.PRODUCT) { //
if(this.form.transferAmount < 1){
this.$modal.msgWarning('请输入整数');
this.submitLoading = false;
return;
}else if (!Number.isInteger(this.form.transferAmount)) {
this.$modal.msgWarning('请输入整数');
// this.value = Math.floor(value); //
this.submitLoading = false;
return;
}
transferProductStockTotal(this.form).then(response => {
this.$modal.msgSuccess("转库存成功");
this.open = false;
this.getList();
this.getTwoList();
}).finally(e=>{
this.submitLoading = false;
});
} else if (this.type === this.STOCK_TYPE.RAW) {
if (this.transferType === '1') {
if (this.transferType === '1') {//
if(this.form.transferAmount < 1){
this.$modal.msgWarning('待转数量请输入整数');
this.submitLoading = false;
return;
}else if (!Number.isInteger(this.form.transferAmount)) {
this.$modal.msgWarning('待转数量请输入整数');
// this.value = Math.floor(value); //
this.submitLoading = false;
return;
}
transferRawStockTotal(this.form).then(response => {
this.$modal.msgSuccess("转库存成功");
this.open = false;
this.getList();
this.getTwoList();
}).finally(e=>{
this.submitLoading = false;
});
} else if (this.transferType === '2') {
this.form.indexStockIds = this.rawStockIds;
for(const instockBatchStr of this.instockBatches){
let instockBatchStrArr = instockBatchStr.split("-");
let instockBatchIndex = parseInt(instockBatchStrArr[0]);
let instockBatch = instockBatchStrArr[1];
if(instockBatch.indexOf(this.RAW_BARCODE_VIRTUAL.EXTERNAL_VIRTUAL) >=0 || instockBatch.indexOf(this.RAW_BARCODE_VIRTUAL.INTERNAL_VIRTUAL) >=0){
this.$modal.msgSuccess("序号:"+(instockBatchIndex+1)+",是虚拟合并的物料,不能转库存");
return;
}
if (this.form.instockBatch.indexOf(this.RAW_BARCODE_VIRTUAL.EXTERNAL_VIRTUAL) >= 0 || this.form.instockBatch.indexOf(this.RAW_BARCODE_VIRTUAL.INTERNAL_VIRTUAL) >= 0) {
this.$modal.msgWarning("序号:" + (parseInt(this.form.index) + 1) + ",是虚拟合并的物料,不能转库存");
this.submitLoading = false;
return;
}
transferRaw(this.form).then(response => {
@ -712,6 +749,8 @@ export default {
this.open = false;
this.getList();
this.getTwoList();
}).finally(e=>{
this.submitLoading = false;
});
}
}
@ -733,9 +772,9 @@ export default {
},
handleViewMaterialInfos(row){
handleViewMaterialInfos(row) {
this.materialListOpen = true;
selectMaterialInfosByVirtualMaterialId({materialId:row.materialId}).then(response => {
selectMaterialInfosByVirtualMaterialId({materialId: row.materialId}).then(response => {
this.materialList = response.rows;
});
}

Loading…
Cancel
Save