|
|
@ -1,6 +1,6 @@ |
|
|
|
package com.win.module.wms.service.packageMassage; |
|
|
|
|
|
|
|
import cn.hutool.core.exceptions.UtilException; |
|
|
|
import cn.hutool.core.util.ReflectUtil; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.win.framework.common.pojo.CustomConditions; |
|
|
|
import com.win.framework.common.pojo.PageResult; |
|
|
@ -11,14 +11,20 @@ import com.win.module.wms.controller.packageMassage.vo.PackageExportReqVO; |
|
|
|
import com.win.module.wms.controller.packageMassage.vo.PackagePageReqVO; |
|
|
|
import com.win.module.wms.controller.packageMassage.vo.PackageUpdateReqVO; |
|
|
|
import com.win.module.wms.convert.packageMassage.PackageConvert; |
|
|
|
import com.win.module.wms.dal.dataobject.accountcalendar.AccountcalendarDO; |
|
|
|
import com.win.module.wms.dal.dataobject.itembasic.ItembasicDO; |
|
|
|
import com.win.module.wms.dal.dataobject.barcode.BarcodeDO; |
|
|
|
import com.win.module.wms.dal.dataobject.itempackaging.ItempackagingDO; |
|
|
|
import com.win.module.wms.dal.dataobject.labelBarbasic.BarbasicDO; |
|
|
|
import com.win.module.wms.dal.dataobject.labeltype.LabeltypeDO; |
|
|
|
import com.win.module.wms.dal.dataobject.packageMassage.PackageDO; |
|
|
|
import com.win.module.wms.dal.dataobject.productionreturnRequest.ProductionreturnRequestDetailDO; |
|
|
|
import com.win.module.wms.dal.dataobject.supplieritem.SupplieritemDO; |
|
|
|
import com.win.module.wms.dal.mysql.labelBarbasic.BarbasicMapper; |
|
|
|
import com.win.module.wms.dal.mysql.packageMassage.PackageMapper; |
|
|
|
import com.win.module.wms.service.itembasic.ItembasicService; |
|
|
|
import com.win.module.wms.dal.mysql.productionreturnRequest.ProductionreturnRequestDetailMapper; |
|
|
|
import com.win.module.wms.service.barcode.BarcodeService; |
|
|
|
import com.win.module.wms.service.itempackaging.ItempackagingService; |
|
|
|
import com.win.module.wms.service.labelBarbasic.BarbasicService; |
|
|
|
import com.win.module.wms.service.labeltype.LabeltypeService; |
|
|
|
import com.win.module.wms.service.supplieritem.SupplieritemService; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
@ -43,9 +49,15 @@ import static com.win.module.wms.enums.ErrorCodeConstants.PACKAGE_NOT_EXISTS; |
|
|
|
public class PackageServiceImpl implements PackageService { |
|
|
|
|
|
|
|
@Resource |
|
|
|
private ItempackagingService itempackagingService; |
|
|
|
private BarbasicMapper barbasicMapper; |
|
|
|
@Resource |
|
|
|
private BarcodeService barcodeService; |
|
|
|
@Resource |
|
|
|
private LabeltypeService labeltypeService; |
|
|
|
@Resource |
|
|
|
private ProductionreturnRequestDetailMapper productionreturnRequestDetailMapper; |
|
|
|
@Resource |
|
|
|
private ItembasicService itembasicService; |
|
|
|
private ItempackagingService itempackagingService; |
|
|
|
@Resource |
|
|
|
private SupplieritemService supplieritemService; |
|
|
|
@Resource |
|
|
@ -148,7 +160,69 @@ public class PackageServiceImpl implements PackageService { |
|
|
|
// TODO: 赋值 生产订单号 生产订单行 班组代码 班次代码
|
|
|
|
} |
|
|
|
packageMapper.insert(packageDo); |
|
|
|
// 更新 生产退料申请 子表数据 包装号字段
|
|
|
|
updateProductionreturnPackingNumber(packageDo.getId(),packageDo.getNumber()); |
|
|
|
// 创建 标签数据
|
|
|
|
generateLabel(packageDo); |
|
|
|
// 返回
|
|
|
|
return packageDo; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 更新 生产退料申请 子表数据 包装号字段 |
|
|
|
* @param packingNumber |
|
|
|
*/ |
|
|
|
private void updateProductionreturnPackingNumber(Long id, String packingNumber) { |
|
|
|
ProductionreturnRequestDetailDO updateObj = new ProductionreturnRequestDetailDO(); |
|
|
|
updateObj.setId(id); |
|
|
|
updateObj.setPackingNumber(packingNumber); |
|
|
|
productionreturnRequestDetailMapper.updateById(updateObj); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 根据 包装 创建 标签 |
|
|
|
* @param packageDO |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Transactional |
|
|
|
public void generateLabel (PackageDO packageDO) { |
|
|
|
BarbasicDO barbasicDO = new BarbasicDO(); |
|
|
|
// 自动生成流水
|
|
|
|
String number = serialNumberApi.generateCode(RuleCodeEnum.LABEL_NUMBER.getCode()); |
|
|
|
barbasicDO.setNumber(number); |
|
|
|
barbasicDO.setRelateNumber(packageDO.getNumber()); |
|
|
|
barbasicDO.setStatus("NEW"); |
|
|
|
// 采购标签
|
|
|
|
if (packageDO.getSupplierCode() != null && !packageDO.getSupplierCode().isEmpty()) { |
|
|
|
barbasicDO.setType("PurchaseLabel"); |
|
|
|
} |
|
|
|
// 制造件标签
|
|
|
|
if (packageDO.getProductionLineCode() != null && !packageDO.getProductionLineCode().isEmpty()) { |
|
|
|
barbasicDO.setType("MakeLabel"); |
|
|
|
} |
|
|
|
// 查询 标签定义
|
|
|
|
LabeltypeDO labeltypeDO = labeltypeService.getLabeltypeDOByLabelType(barbasicDO.getType()); |
|
|
|
// 查询 条码片段
|
|
|
|
List<BarcodeDO> barcodeDOList = barcodeService.getBarcodeDoListByLabelType(barbasicDO.getType()); |
|
|
|
// 数据头
|
|
|
|
String header = labeltypeDO.getHeader(); |
|
|
|
// 版本
|
|
|
|
String version = labeltypeDO.getVersion(); |
|
|
|
// 分隔符
|
|
|
|
String separators = labeltypeDO.getSeparators(); |
|
|
|
// 标签头 拼接
|
|
|
|
String headerStr = header + separators + version + separators; |
|
|
|
// 内容 拼接
|
|
|
|
StringBuffer contentStr = new StringBuffer(); |
|
|
|
for (BarcodeDO barcodeDO: barcodeDOList){ |
|
|
|
Object subClassObject = ReflectUtil.invoke(packageDO, "get" + barcodeDO.getEntityProperties()); |
|
|
|
String pChar = barcodeDO.getPrefixChar(); |
|
|
|
if (subClassObject==null || subClassObject.equals("")) { |
|
|
|
subClassObject = ""; |
|
|
|
} |
|
|
|
contentStr.append(pChar + subClassObject + separators); |
|
|
|
} |
|
|
|
barbasicDO.setBarcodeString(headerStr + contentStr); |
|
|
|
barbasicMapper.insert(barbasicDO); |
|
|
|
} |
|
|
|
} |
|
|
|