feat: 生产入库
This commit is contained in:
parent
8c15fed8c0
commit
6be6867137
@ -111,6 +111,8 @@ public interface Constant {
|
||||
|
||||
String PICKING_STATUS_CLOSE = "CLOSE"; //拣货状态过账
|
||||
|
||||
String DOCUMENT_STATUS_SAVE = "SAVE"; //单据表状态新建
|
||||
|
||||
String DOCUMENT_STATUS_CLOSE = "CLOSE"; //单据表状态关闭
|
||||
|
||||
String DOCUMENT_STATUS_SUBMIT = "SUBMIT"; //单据表状态提交
|
||||
@ -123,7 +125,7 @@ public interface Constant {
|
||||
|
||||
String DOCUMENT_STATUS_TBC = "TBC"; //单据表状态待确认
|
||||
|
||||
String DOCUMENT_STATUS_REJECT = "REJECT"; //单据表状态待确认
|
||||
String DOCUMENT_STATUS_REJECT = "REJECT"; //单据表状态拒收
|
||||
|
||||
String WMS_INVENTORY_LOG_SALES_OUT_CANCEL = "SALES_OUT_CANCEL"; //销售过账冲销
|
||||
|
||||
|
||||
@ -6,19 +6,17 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.foreverwin.iep.common.base.FrontPage;
|
||||
import com.foreverwin.iep.prd.entity.Item;
|
||||
import com.foreverwin.mom.common.core.exception.BusinessException;
|
||||
import com.foreverwin.mom.common.core.util.R;
|
||||
import com.foreverwin.mom.common.data.tenant.TenantContextHolder;
|
||||
import com.foreverwin.mom.common.log.annotation.SysLog;
|
||||
import com.foreverwin.mom.common.security.util.SecurityUtils;
|
||||
import com.foreverwin.iep.common.base.FrontPage;
|
||||
import com.foreverwin.mom.wms.constant.Constant;
|
||||
import com.foreverwin.mom.wms.constant.KeyWordConstant;
|
||||
import com.foreverwin.mom.wms.dto.*;
|
||||
import com.foreverwin.mom.wms.entity.Carrier;
|
||||
import com.foreverwin.mom.wms.entity.Document;
|
||||
import com.foreverwin.mom.wms.entity.DocumentDetailed;
|
||||
import com.foreverwin.mom.wms.entity.*;
|
||||
import com.foreverwin.mom.wms.mapper.DocumentMapper;
|
||||
import com.foreverwin.mom.wms.mapper.WmsItemMapper;
|
||||
import com.foreverwin.mom.wms.service.*;
|
||||
@ -52,16 +50,18 @@ public class DocumentController {
|
||||
|
||||
private final DocumentSfcService documentSfcService;
|
||||
|
||||
private final BarCodeQueryService barCodeQueryService;
|
||||
private final PickingService pickingService;
|
||||
|
||||
private final BarCodeQueryService barCodeQueryService;
|
||||
|
||||
private final WmsCarrierService wmsCarrierService;
|
||||
|
||||
private final WmsItemMapper wmsItemMapper;
|
||||
|
||||
|
||||
private final DocumentMapper documentMapper;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
|
||||
/**
|
||||
* 采购入库提交
|
||||
*
|
||||
* @param documentDetailedList 单据表
|
||||
@ -856,7 +856,7 @@ public class DocumentController {
|
||||
}
|
||||
|
||||
@PostMapping("/validateImport")
|
||||
public R validateImport(@RequestBody List<DocumentDetailed> documentDetailedList){
|
||||
public R validateImport(@RequestBody List<DocumentDetailed> documentDetailedList) {
|
||||
documentService.validateImport(documentDetailedList);
|
||||
return R.ok();
|
||||
}
|
||||
@ -877,7 +877,20 @@ public class DocumentController {
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------
|
||||
@ApiOperation(value = "通过id查询明细", notes = "通过id查询明细")
|
||||
@ApiOperation(value = "获取过账单据明细", notes = "获取过账单据明细")
|
||||
@GetMapping("/detail/getCloseDocumentDetail")
|
||||
@SysLog("获取过账单据明细")
|
||||
public R getCloseDocumentDetail(String documentNo) {
|
||||
return R.ok(documentSfcService.lambdaQuery().eq(DocumentSfc::getSite, TenantContextHolder.getTenantId()).eq(DocumentSfc::getDocumentNo, documentNo).orderByAsc(DocumentSfc::getSeq));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "通过单据号获取已拣货数据", notes = "通过单据号获取已拣货数据")
|
||||
@GetMapping("/detail/getPickDocumentDetail")
|
||||
public R getPickDocumentDetail(String documentNo) {
|
||||
return R.ok(pickingService.lambdaQuery().eq(Picking::getSite, TenantContextHolder.getTenantId()).eq(Picking::getDocumentNo, documentNo).orderByAsc(Picking::getSeq).list());
|
||||
}
|
||||
|
||||
@ApiOperation(value = "通过id查询明细", notes = "通过id查询明细")
|
||||
@GetMapping("/detail/getSubmitDocumentDetail")
|
||||
public R getSubmitDocumentDetail(String documentNo) {
|
||||
return R.ok(documentService.getSubmitDocumentDetail(TenantContextHolder.getTenantId(), documentNo));
|
||||
@ -886,10 +899,10 @@ public class DocumentController {
|
||||
@ApiOperation(value = "单据扫码", notes = "单据扫码")
|
||||
@GetMapping("/scanCode")
|
||||
@SysLog("单据扫码")
|
||||
public R scanCode(String code) {
|
||||
public R scanCode(String code, boolean searchFull) {
|
||||
String site = TenantContextHolder.getTenantId();
|
||||
String user = SecurityUtils.getUserName();
|
||||
return R.ok(documentService.scanCode(site, user, code));
|
||||
return R.ok(documentService.scanCode(site, user, code, searchFull));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "单据拣货保存", notes = "单据拣货保存")
|
||||
@ -943,9 +956,9 @@ public class DocumentController {
|
||||
}
|
||||
|
||||
@ApiOperation(value = "单据出库过账", notes = "单据出库过账")
|
||||
@PostMapping("/postOutDocument")
|
||||
@PostMapping("/postOut")
|
||||
@SysLog("单据出库过账")
|
||||
public R postOutDocument(@RequestBody SingleStringDTO dto) {
|
||||
public R postOut(@RequestBody SingleStringDTO dto) {
|
||||
String site = TenantContextHolder.getTenantStrId();
|
||||
String user = SecurityUtils.getUserName();
|
||||
documentService.postOutDocument(site, user, dto.getStr());
|
||||
@ -953,9 +966,9 @@ public class DocumentController {
|
||||
}
|
||||
|
||||
@ApiOperation(value = "单据入库过账", notes = "单据入库过账")
|
||||
@PostMapping("/postInDocument")
|
||||
@PostMapping("/postIn")
|
||||
@SysLog("单据入库过账")
|
||||
public R postInDocument(@RequestBody SingleStringDTO dto) {
|
||||
public R postIn(@RequestBody SingleStringDTO dto) {
|
||||
String site = TenantContextHolder.getTenantStrId();
|
||||
String user = SecurityUtils.getUserName();
|
||||
documentService.postInDocument(site, user, dto.getStr());
|
||||
@ -971,8 +984,8 @@ public class DocumentController {
|
||||
documentService.postTransferDocument(site, user, dto.getStr());
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
/**
|
||||
* 分页查询订单信息
|
||||
*/
|
||||
@ApiOperation(value = "分页查询订单信息", notes = "分页查询订单信息")
|
||||
|
||||
@ -15,7 +15,6 @@ import com.foreverwin.mom.wms.entity.Inventory;
|
||||
import com.foreverwin.mom.wms.service.BarCodeQueryService;
|
||||
import com.foreverwin.mom.wms.service.FreezeService;
|
||||
import com.foreverwin.mom.wms.service.ZWmsInventoryService;
|
||||
import com.foreverwin.mom.wms.util.StringUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
@ -26,7 +25,6 @@ import org.springframework.web.context.request.ServletRequestAttributes;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@ -370,14 +368,14 @@ public class ZWmsInventoryController {
|
||||
String user = SecurityUtils.getUserName();
|
||||
List<String> inventoryIdList = (List<String>) request.get("inventoryIdList");
|
||||
//打印
|
||||
String printer = request.get("printer").toString();
|
||||
if (StringUtil.isEmpty(printer)) {
|
||||
throw BusinessException.build("打印机未维护");
|
||||
} else {
|
||||
String mergeInventoryId = inventoryService.mergeInventory(site, user, inventoryIdList);
|
||||
barCodeQueryService.batchPrint(Collections.singletonList(mergeInventoryId), printer);
|
||||
return R.ok(mergeInventoryId);
|
||||
}
|
||||
/*String printer = request.get("printer").toString();
|
||||
if (StringUtil.isEmpty(printer)) {
|
||||
throw BusinessException.build("打印机未维护");
|
||||
} else {*/
|
||||
String mergeInventoryId = inventoryService.mergeInventory(site, user, inventoryIdList);
|
||||
//barCodeQueryService.batchPrint(Collections.singletonList(mergeInventoryId), printer);
|
||||
return R.ok(mergeInventoryId);
|
||||
//}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -17,357 +17,366 @@ import java.util.Set;
|
||||
|
||||
public interface DocumentService extends IService<Document> {
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param frontPage
|
||||
* @return
|
||||
*/
|
||||
IPage<Document> selectPage(Page<Document> frontPage, Document document);
|
||||
|
||||
List<Document> selectList(Document document);
|
||||
|
||||
IPage<Document> getDocumentList(IPage iPage, String site, String status, String documentType, String searchText);
|
||||
|
||||
List<Map<String, Object>> getWarehouse(String site);
|
||||
|
||||
List<Map<String, Object>> getCWarehouse(String site);
|
||||
|
||||
List<Map<String, Object>> getQty(String site, String item);
|
||||
|
||||
List<Map<String, Object>> getOperationRules(String site, String rules);
|
||||
|
||||
boolean userCheck(String site, String documentType);
|
||||
|
||||
List<DocumentDetailed> doSave(DocumentSaveRequestDTO document);
|
||||
|
||||
void testPrint(String documentNo);
|
||||
|
||||
/**
|
||||
* 单据取消
|
||||
*
|
||||
* @param list
|
||||
* @return
|
||||
*/
|
||||
boolean checkCancel(List<String> list);
|
||||
|
||||
/**
|
||||
* 单据拒收
|
||||
*
|
||||
* @param list
|
||||
* @return
|
||||
*/
|
||||
boolean checkReject(List<String> list);
|
||||
|
||||
//List<DocumentDetailed> getDocumentDetail(String documentNo);
|
||||
|
||||
/**
|
||||
* 扫描条码查询库存
|
||||
*
|
||||
* @param site
|
||||
* @param item
|
||||
* @param batch
|
||||
* @param sourceWarehouse
|
||||
* @param inventoryIdOrCarrier
|
||||
* @param documentNo
|
||||
* @param verifyDefaultStorageBin
|
||||
* @param fifo
|
||||
* @param inventoryDtoList
|
||||
* @return
|
||||
*/
|
||||
@Deprecated
|
||||
DocumentInventoryDto getInventoryQty(String site, String item, String batch, String sourceWarehouse, String inventoryIdOrCarrier,
|
||||
String documentNo, String verifyDefaultStorageBin, String fifo, List<DocumentInventoryDto> inventoryDtoList);
|
||||
|
||||
/**
|
||||
* 扫描条码查询库存,支持条码/组条码/箱条码/托条码
|
||||
*
|
||||
* @param site
|
||||
* @param documentDetailed
|
||||
* @param passBox 忽略箱号
|
||||
* @return
|
||||
*/
|
||||
List<DocumentInventoryDto> getInventoryQtyNew(String site, DocumentDetailedDto documentDetailed, boolean passSingleInv, boolean passGroup, boolean passBox, boolean passTray);
|
||||
|
||||
List<DocumentInventoryDto> getInventoryQtyNew(String site, DocumentDetailedDto documentDetailed, boolean passSingleInv, boolean passGroup, boolean passBox, boolean passTray, boolean passOverdue);
|
||||
|
||||
/**
|
||||
* 成品采购查询数量
|
||||
*
|
||||
* @param detailedDto
|
||||
* @return
|
||||
*/
|
||||
DocumentInventoryDto getFinishedProductsPurchaseQty(DocumentDetailedDto detailedDto);
|
||||
|
||||
/**
|
||||
* 通过行项目获取已领料数据
|
||||
*
|
||||
* @param documentDetailed
|
||||
* @return
|
||||
*/
|
||||
List<DocumentInventoryDto> getItemInventory(DocumentDetailed documentDetailed);
|
||||
|
||||
/**
|
||||
* 生产退料/销售退货扫条码
|
||||
*
|
||||
* @param documentDetailed
|
||||
* @return
|
||||
*/
|
||||
@Deprecated
|
||||
DocumentInventoryDto getInventoryOriginalQty(DocumentDetailedDto documentDetailed);
|
||||
|
||||
DocumentInventoryDto getInventoryOriginalQtyNew(DocumentDetailedDto documentDetailed);
|
||||
|
||||
/**
|
||||
* 拣货提交
|
||||
*
|
||||
* @param documentDetailedList
|
||||
*/
|
||||
void pickingSubmit(List<DocumentDetailedDto> documentDetailedList);
|
||||
|
||||
/**
|
||||
* 接口触发出货(已停用)
|
||||
*
|
||||
* @param site
|
||||
* @param user
|
||||
* @param documentDetaileds
|
||||
*/
|
||||
@Deprecated
|
||||
void pickSubmit(String site, String user, List<DocumentDetailed> documentDetaileds);
|
||||
|
||||
List<Document> checkSubmit(String user, List<Document> documents);
|
||||
|
||||
List<Document> checkSubmit(String user, List<Document> documents, String activityId, String newDocumentNo);
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* 生产退料入库提交
|
||||
*
|
||||
* @param itemList
|
||||
*/
|
||||
List<String> returnSubmit(List<DocumentDetailedDto> itemList);
|
||||
|
||||
/**
|
||||
* 生产领料, 成本中心领料,报废出库, 销售退货,在建工程领料
|
||||
*
|
||||
* @param documentDetailedList
|
||||
*/
|
||||
void productionRequisitionSubmit(List<DocumentDetailedDto> documentDetailedList);
|
||||
|
||||
void productionRequisitionSubmit(List<DocumentDetailedDto> documentDetailedList, LocalDate postDate);
|
||||
|
||||
/**
|
||||
* 成品入库、生产退料
|
||||
*
|
||||
* @param documentDetailedList
|
||||
*/
|
||||
void finishedProductsWarehouseSubmit(List<DocumentDetailedDto> documentDetailedList);
|
||||
|
||||
/**
|
||||
* 采购到货提交
|
||||
*
|
||||
* @param documentDetailedList
|
||||
* @return
|
||||
*/
|
||||
Map<String, Set<String>> procurementStorageSubmit(List<DocumentDetailedDto> documentDetailedList);
|
||||
|
||||
/**
|
||||
* 销售退货
|
||||
*
|
||||
* @param documentDetailedList
|
||||
*/
|
||||
Map<String,List<String>> saleReturnSubmit(List<DocumentDetailedDto> documentDetailedList);
|
||||
|
||||
/**
|
||||
* 成品采购入库
|
||||
*
|
||||
* @param documentDetailedList
|
||||
*/
|
||||
void finishedProductsPurchaseSubmit(List<DocumentDetailedDto> documentDetailedList);
|
||||
|
||||
/**
|
||||
* 调拨
|
||||
*
|
||||
* @param documentDetailedList
|
||||
*/
|
||||
void transferSubmit(List<DocumentDetailedDto> documentDetailedList);
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* @param documentDetailed
|
||||
* @return
|
||||
*/
|
||||
DocumentInventoryDto getFinishedProductQty(DocumentDetailedDto documentDetailed);
|
||||
|
||||
/**
|
||||
* 退货查询出货数量
|
||||
*
|
||||
* @param documentDetailed
|
||||
* @return
|
||||
*/
|
||||
DocumentInventoryDto getSaleOutQty(DocumentDetailedDto documentDetailed);
|
||||
|
||||
/**
|
||||
* 退货根据箱条码查询库存
|
||||
*
|
||||
* @param carrier
|
||||
* @return
|
||||
*/
|
||||
List<DocumentSfc> getSaleInventoryId(String carrier);
|
||||
|
||||
/**
|
||||
* 单据关闭
|
||||
*
|
||||
* @param documentNo
|
||||
*/
|
||||
void closeDocumentByNo(String documentNo);
|
||||
|
||||
void rejectDocument(String documentNo);
|
||||
|
||||
/**
|
||||
* 校验先进先出(原材料/包材)
|
||||
*
|
||||
* @param site
|
||||
* @param batch 批次(可选)
|
||||
* @param inventoryList 校验的条码
|
||||
*/
|
||||
void checkInventoryFifo(String site, String batch, List<String> inventoryList, boolean exceptPicking, boolean userCreateDate);
|
||||
|
||||
/**
|
||||
* 校验先进先出(半成品/成品)
|
||||
*
|
||||
* @param site
|
||||
* @param carrierList
|
||||
* @param exceptPicking
|
||||
*/
|
||||
void checkCarrierFifo(String site, List<String> carrierList, boolean exceptPicking);
|
||||
|
||||
/**
|
||||
* 扫描条码查询库存,额外校验拣货表
|
||||
*
|
||||
* @param site
|
||||
* @param documentDetailed
|
||||
* @return
|
||||
*/
|
||||
List<DocumentInventoryDto> getPickingInventoryQty(String site, DocumentDetailedDto documentDetailed);
|
||||
|
||||
/**
|
||||
* 单据号生成
|
||||
*
|
||||
* @param site
|
||||
* @param dataField
|
||||
* @return
|
||||
*/
|
||||
String getCommentCode(String site, String dataField);
|
||||
|
||||
/**
|
||||
* 送货单PDF
|
||||
*
|
||||
* @param documentNo
|
||||
* @param addressType
|
||||
*/
|
||||
void deliverOrderPrint(String site, String documentNo, String addressType);
|
||||
|
||||
IPage<DocumentWithPoOrderDTO> pagePurchaseInToStorageReg(IPage iPage, String site, String documentType, String poNumber, String documentNo, String customerNo);
|
||||
|
||||
void procurementStorageRegister(String site, String user, List<PoOrderDetailDTO> poOrderDetailDTOList);
|
||||
|
||||
void procurementStorageRegisterCancel(String site, String user, PoOrderDetailDTO poOrderDetail);
|
||||
|
||||
void productionRequisitionCancel(String site, String user, String documentNo);
|
||||
|
||||
void saleReturnCancel(String site, String user, String documentNo);
|
||||
|
||||
void iqcResult(String site, String user, List<DocumentIqcResultRequest> requestList);
|
||||
|
||||
void oqcResult(String site, String user, List<DocumentOqcResultRequest> requestList);
|
||||
|
||||
void noEntityPost(String site, String user, String documentNo, LocalDateTime postDateTime);
|
||||
|
||||
void noEntityPostCancel(String site, String user, String documentNo, LocalDateTime cancelDateTime);
|
||||
|
||||
IPage<Document> pageWithWarehouse(IPage iPage, Wrapper<Document> wrapper);
|
||||
|
||||
Map<String, String> oneClickPassValidate(String site,List<DocumentDetailedDto> list);
|
||||
|
||||
void validateImport(List<DocumentDetailed> documentDetailedList);
|
||||
|
||||
/**
|
||||
* 销售退货零库存退库
|
||||
* @param itemList
|
||||
*/
|
||||
void saleReturnNoInventorySubmit(List<DocumentDetailedDto> itemList);
|
||||
|
||||
//------------------------------------------------------------------------------------------------------
|
||||
|
||||
List<DocumentDetailed> getSubmitDocumentDetail(String site, String documentNo);
|
||||
|
||||
List<ScanCodeDTO> scanCode(String site, String user, String code);
|
||||
|
||||
/**
|
||||
* 保存拣货
|
||||
* @param site
|
||||
* @param user
|
||||
* @param documentNo
|
||||
* @param list
|
||||
*/
|
||||
void savePicking(String site, String user,String documentNo, List<ScanCodeDTO> list);
|
||||
|
||||
/**
|
||||
* 保存拣货(带校验)
|
||||
* @param site
|
||||
* @param user
|
||||
* @param documentNo
|
||||
* @param list
|
||||
* @param checkScanAll 是否校验托全扫描
|
||||
*/
|
||||
void savePicking(String site, String user, String documentNo, List<ScanCodeDTO> list, boolean checkScanAll);
|
||||
|
||||
/**
|
||||
* 拣货清除
|
||||
* @param site
|
||||
* @param user
|
||||
* @param documentNo
|
||||
*/
|
||||
void cleanPicking(String site, String user,String documentNo);
|
||||
|
||||
/**
|
||||
* 单据拒收
|
||||
* @param site
|
||||
* @param user
|
||||
* @param documentNo
|
||||
*/
|
||||
void rejectDocument(String site, String user, String documentNo);
|
||||
|
||||
/**
|
||||
* 单据提交
|
||||
* @param site
|
||||
* @param user
|
||||
* @param documentNo
|
||||
*/
|
||||
void submitDocumentTBC(String site, String user, String documentNo);
|
||||
|
||||
/**
|
||||
* 单据出库过账
|
||||
* @param site
|
||||
* @param user
|
||||
* @param documentNo
|
||||
*/
|
||||
void postOutDocument(String site, String user, String documentNo);
|
||||
|
||||
/**
|
||||
* 单据入库过账
|
||||
* @param site
|
||||
* @param user
|
||||
* @param documentNo
|
||||
*/
|
||||
void postInDocument(String site, String user, String documentNo);
|
||||
|
||||
/**
|
||||
* 单据调拨过账
|
||||
* @param site
|
||||
* @param user
|
||||
* @param documentNo
|
||||
*/
|
||||
void postTransferDocument(String site, String user, String documentNo);
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param frontPage
|
||||
* @return
|
||||
*/
|
||||
IPage<Document> selectPage(Page<Document> frontPage, Document document);
|
||||
|
||||
List<Document> selectList(Document document);
|
||||
|
||||
IPage<Document> getDocumentList(IPage iPage, String site, String status, String documentType, String searchText);
|
||||
|
||||
List<Map<String, Object>> getWarehouse(String site);
|
||||
|
||||
List<Map<String, Object>> getCWarehouse(String site);
|
||||
|
||||
List<Map<String, Object>> getQty(String site, String item);
|
||||
|
||||
List<Map<String, Object>> getOperationRules(String site, String rules);
|
||||
|
||||
boolean userCheck(String site, String documentType);
|
||||
|
||||
List<DocumentDetailed> doSave(DocumentSaveRequestDTO document);
|
||||
|
||||
void testPrint(String documentNo);
|
||||
|
||||
/**
|
||||
* 单据取消
|
||||
*
|
||||
* @param list
|
||||
* @return
|
||||
*/
|
||||
boolean checkCancel(List<String> list);
|
||||
|
||||
/**
|
||||
* 单据拒收
|
||||
*
|
||||
* @param list
|
||||
* @return
|
||||
*/
|
||||
boolean checkReject(List<String> list);
|
||||
|
||||
//List<DocumentDetailed> getDocumentDetail(String documentNo);
|
||||
|
||||
/**
|
||||
* 扫描条码查询库存
|
||||
*
|
||||
* @param site
|
||||
* @param item
|
||||
* @param batch
|
||||
* @param sourceWarehouse
|
||||
* @param inventoryIdOrCarrier
|
||||
* @param documentNo
|
||||
* @param verifyDefaultStorageBin
|
||||
* @param fifo
|
||||
* @param inventoryDtoList
|
||||
* @return
|
||||
*/
|
||||
@Deprecated
|
||||
DocumentInventoryDto getInventoryQty(String site, String item, String batch, String sourceWarehouse, String inventoryIdOrCarrier,
|
||||
String documentNo, String verifyDefaultStorageBin, String fifo, List<DocumentInventoryDto> inventoryDtoList);
|
||||
|
||||
/**
|
||||
* 扫描条码查询库存,支持条码/组条码/箱条码/托条码
|
||||
*
|
||||
* @param site
|
||||
* @param documentDetailed
|
||||
* @param passBox 忽略箱号
|
||||
* @return
|
||||
*/
|
||||
List<DocumentInventoryDto> getInventoryQtyNew(String site, DocumentDetailedDto documentDetailed, boolean passSingleInv, boolean passGroup, boolean passBox, boolean passTray);
|
||||
|
||||
List<DocumentInventoryDto> getInventoryQtyNew(String site, DocumentDetailedDto documentDetailed, boolean passSingleInv, boolean passGroup, boolean passBox, boolean passTray, boolean passOverdue);
|
||||
|
||||
/**
|
||||
* 成品采购查询数量
|
||||
*
|
||||
* @param detailedDto
|
||||
* @return
|
||||
*/
|
||||
DocumentInventoryDto getFinishedProductsPurchaseQty(DocumentDetailedDto detailedDto);
|
||||
|
||||
/**
|
||||
* 通过行项目获取已领料数据
|
||||
*
|
||||
* @param documentDetailed
|
||||
* @return
|
||||
*/
|
||||
List<DocumentInventoryDto> getItemInventory(DocumentDetailed documentDetailed);
|
||||
|
||||
/**
|
||||
* 生产退料/销售退货扫条码
|
||||
*
|
||||
* @param documentDetailed
|
||||
* @return
|
||||
*/
|
||||
@Deprecated
|
||||
DocumentInventoryDto getInventoryOriginalQty(DocumentDetailedDto documentDetailed);
|
||||
|
||||
DocumentInventoryDto getInventoryOriginalQtyNew(DocumentDetailedDto documentDetailed);
|
||||
|
||||
/**
|
||||
* 拣货提交
|
||||
*
|
||||
* @param documentDetailedList
|
||||
*/
|
||||
void pickingSubmit(List<DocumentDetailedDto> documentDetailedList);
|
||||
|
||||
/**
|
||||
* 接口触发出货(已停用)
|
||||
*
|
||||
* @param site
|
||||
* @param user
|
||||
* @param documentDetaileds
|
||||
*/
|
||||
@Deprecated
|
||||
void pickSubmit(String site, String user, List<DocumentDetailed> documentDetaileds);
|
||||
|
||||
List<Document> checkSubmit(String user, List<Document> documents);
|
||||
|
||||
List<Document> checkSubmit(String user, List<Document> documents, String activityId, String newDocumentNo);
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* 生产退料入库提交
|
||||
*
|
||||
* @param itemList
|
||||
*/
|
||||
List<String> returnSubmit(List<DocumentDetailedDto> itemList);
|
||||
|
||||
/**
|
||||
* 生产领料, 成本中心领料,报废出库, 销售退货,在建工程领料
|
||||
*
|
||||
* @param documentDetailedList
|
||||
*/
|
||||
void productionRequisitionSubmit(List<DocumentDetailedDto> documentDetailedList);
|
||||
|
||||
void productionRequisitionSubmit(List<DocumentDetailedDto> documentDetailedList, LocalDate postDate);
|
||||
|
||||
/**
|
||||
* 成品入库、生产退料
|
||||
*
|
||||
* @param documentDetailedList
|
||||
*/
|
||||
void finishedProductsWarehouseSubmit(List<DocumentDetailedDto> documentDetailedList);
|
||||
|
||||
/**
|
||||
* 采购到货提交
|
||||
*
|
||||
* @param documentDetailedList
|
||||
* @return
|
||||
*/
|
||||
Map<String, Set<String>> procurementStorageSubmit(List<DocumentDetailedDto> documentDetailedList);
|
||||
|
||||
/**
|
||||
* 销售退货
|
||||
*
|
||||
* @param documentDetailedList
|
||||
*/
|
||||
Map<String, List<String>> saleReturnSubmit(List<DocumentDetailedDto> documentDetailedList);
|
||||
|
||||
/**
|
||||
* 成品采购入库
|
||||
*
|
||||
* @param documentDetailedList
|
||||
*/
|
||||
void finishedProductsPurchaseSubmit(List<DocumentDetailedDto> documentDetailedList);
|
||||
|
||||
/**
|
||||
* 调拨
|
||||
*
|
||||
* @param documentDetailedList
|
||||
*/
|
||||
void transferSubmit(List<DocumentDetailedDto> documentDetailedList);
|
||||
//------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* @param documentDetailed
|
||||
* @return
|
||||
*/
|
||||
DocumentInventoryDto getFinishedProductQty(DocumentDetailedDto documentDetailed);
|
||||
|
||||
/**
|
||||
* 退货查询出货数量
|
||||
*
|
||||
* @param documentDetailed
|
||||
* @return
|
||||
*/
|
||||
DocumentInventoryDto getSaleOutQty(DocumentDetailedDto documentDetailed);
|
||||
|
||||
/**
|
||||
* 退货根据箱条码查询库存
|
||||
*
|
||||
* @param carrier
|
||||
* @return
|
||||
*/
|
||||
List<DocumentSfc> getSaleInventoryId(String carrier);
|
||||
|
||||
/**
|
||||
* 单据关闭
|
||||
*
|
||||
* @param documentNo
|
||||
*/
|
||||
void closeDocumentByNo(String documentNo);
|
||||
|
||||
void rejectDocument(String documentNo);
|
||||
|
||||
/**
|
||||
* 校验先进先出(原材料/包材)
|
||||
*
|
||||
* @param site
|
||||
* @param batch 批次(可选)
|
||||
* @param inventoryList 校验的条码
|
||||
*/
|
||||
void checkInventoryFifo(String site, String batch, List<String> inventoryList, boolean exceptPicking, boolean userCreateDate);
|
||||
|
||||
/**
|
||||
* 校验先进先出(半成品/成品)
|
||||
*
|
||||
* @param site
|
||||
* @param carrierList
|
||||
* @param exceptPicking
|
||||
*/
|
||||
void checkCarrierFifo(String site, List<String> carrierList, boolean exceptPicking);
|
||||
|
||||
/**
|
||||
* 扫描条码查询库存,额外校验拣货表
|
||||
*
|
||||
* @param site
|
||||
* @param documentDetailed
|
||||
* @return
|
||||
*/
|
||||
List<DocumentInventoryDto> getPickingInventoryQty(String site, DocumentDetailedDto documentDetailed);
|
||||
|
||||
/**
|
||||
* 单据号生成
|
||||
*
|
||||
* @param site
|
||||
* @param dataField
|
||||
* @return
|
||||
*/
|
||||
String getCommentCode(String site, String dataField);
|
||||
|
||||
/**
|
||||
* 送货单PDF
|
||||
*
|
||||
* @param documentNo
|
||||
* @param addressType
|
||||
*/
|
||||
void deliverOrderPrint(String site, String documentNo, String addressType);
|
||||
|
||||
IPage<DocumentWithPoOrderDTO> pagePurchaseInToStorageReg(IPage iPage, String site, String documentType, String poNumber, String documentNo, String customerNo);
|
||||
|
||||
void procurementStorageRegister(String site, String user, List<PoOrderDetailDTO> poOrderDetailDTOList);
|
||||
|
||||
void procurementStorageRegisterCancel(String site, String user, PoOrderDetailDTO poOrderDetail);
|
||||
|
||||
void productionRequisitionCancel(String site, String user, String documentNo);
|
||||
|
||||
void saleReturnCancel(String site, String user, String documentNo);
|
||||
|
||||
void iqcResult(String site, String user, List<DocumentIqcResultRequest> requestList);
|
||||
|
||||
void oqcResult(String site, String user, List<DocumentOqcResultRequest> requestList);
|
||||
|
||||
void noEntityPost(String site, String user, String documentNo, LocalDateTime postDateTime);
|
||||
|
||||
void noEntityPostCancel(String site, String user, String documentNo, LocalDateTime cancelDateTime);
|
||||
|
||||
IPage<Document> pageWithWarehouse(IPage iPage, Wrapper<Document> wrapper);
|
||||
|
||||
Map<String, String> oneClickPassValidate(String site, List<DocumentDetailedDto> list);
|
||||
|
||||
void validateImport(List<DocumentDetailed> documentDetailedList);
|
||||
|
||||
/**
|
||||
* 销售退货零库存退库
|
||||
*
|
||||
* @param itemList
|
||||
*/
|
||||
void saleReturnNoInventorySubmit(List<DocumentDetailedDto> itemList);
|
||||
|
||||
//------------------------------------------------------------------------------------------------------
|
||||
|
||||
List<DocumentDetailed> getSubmitDocumentDetail(String site, String documentNo);
|
||||
|
||||
List<ScanCodeDTO> scanCode(String site, String user, String code, boolean fullSearch);
|
||||
|
||||
/**
|
||||
* 保存拣货
|
||||
*
|
||||
* @param site
|
||||
* @param user
|
||||
* @param documentNo
|
||||
* @param list
|
||||
*/
|
||||
void savePicking(String site, String user, String documentNo, List<ScanCodeDTO> list);
|
||||
|
||||
/**
|
||||
* 保存拣货(带校验)
|
||||
*
|
||||
* @param site
|
||||
* @param user
|
||||
* @param documentNo
|
||||
* @param list
|
||||
* @param checkScanAll 是否校验托全扫描
|
||||
*/
|
||||
void savePicking(String site, String user, String documentNo, List<ScanCodeDTO> list, boolean checkScanAll);
|
||||
|
||||
/**
|
||||
* 拣货清除
|
||||
*
|
||||
* @param site
|
||||
* @param user
|
||||
* @param documentNo
|
||||
*/
|
||||
void cleanPicking(String site, String user, String documentNo);
|
||||
|
||||
/**
|
||||
* 单据拒收
|
||||
*
|
||||
* @param site
|
||||
* @param user
|
||||
* @param documentNo
|
||||
*/
|
||||
void rejectDocument(String site, String user, String documentNo);
|
||||
|
||||
/**
|
||||
* 单据提交
|
||||
*
|
||||
* @param site
|
||||
* @param user
|
||||
* @param documentNo
|
||||
*/
|
||||
void submitDocumentTBC(String site, String user, String documentNo);
|
||||
|
||||
/**
|
||||
* 单据出库过账
|
||||
*
|
||||
* @param site
|
||||
* @param user
|
||||
* @param documentNo
|
||||
*/
|
||||
void postOutDocument(String site, String user, String documentNo);
|
||||
|
||||
/**
|
||||
* 单据入库过账
|
||||
*
|
||||
* @param site
|
||||
* @param user
|
||||
* @param documentNo
|
||||
*/
|
||||
void postInDocument(String site, String user, String documentNo);
|
||||
|
||||
/**
|
||||
* 单据调拨过账
|
||||
*
|
||||
* @param site
|
||||
* @param user
|
||||
* @param documentNo
|
||||
*/
|
||||
void postTransferDocument(String site, String user, String documentNo);
|
||||
}
|
||||
|
||||
@ -3803,75 +3803,76 @@ public class DocumentServiceImpl extends ServiceImpl<DocumentMapper, Document> i
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public List<DocumentDetailed> doSave(DocumentSaveRequestDTO document) {
|
||||
List<DocumentDetailed> list = document.getDocumentDetailedList();
|
||||
String site = TenantContextHolder.getTenantStrId();
|
||||
String user = SecurityUtils.getUserName();
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
List<DocumentDetailed> list = document.getDocumentDetailedList();
|
||||
String site = TenantContextHolder.getTenantStrId();
|
||||
String user = SecurityUtils.getUserName();
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
|
||||
if ("SAVE".equals(document.getState())) {
|
||||
String documentType = document.getDocumentType();
|
||||
|
||||
String prefix = documentMapper.getDocumentPrefix(site, documentType);
|
||||
if ("SAVE".equals(document.getState())) {
|
||||
String documentType = document.getDocumentType();
|
||||
|
||||
String prefix = documentMapper.getDocumentPrefix(site, documentType);
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("DOCUMENT_TYPE", prefix);
|
||||
String documentNo = generatorDocumentNo("ZW_DOCUMENT_NO", map);
|
||||
|
||||
|
||||
String handle = Document.genHandle(site, documentNo);
|
||||
document.setHandle(handle);
|
||||
document.setSite(site);
|
||||
document.setDocumentNo(documentNo);
|
||||
document.setCreateDate(now);
|
||||
document.setCreateUser(user);
|
||||
String state = document.getState();
|
||||
for (DocumentDetailed parameter : list) {
|
||||
parameter.setDocumentType(documentType);
|
||||
parameter.setDocumentNo(documentNo);
|
||||
parameter.setHandle(DocumentDetailed.genHandle(parameter.getDocumentNo(), parameter.getItem(), parameter.getSeq()));
|
||||
parameter.setCreateUser(document.getCreateUser());
|
||||
parameter.setDocumentBo(document.getHandle());
|
||||
parameter.setSite(site);
|
||||
parameter.setCreateDate(document.getCreateDate());
|
||||
if ("REJECT".equals(parameter.getState())) {
|
||||
parameter.setActualQuantity(BigDecimal.ZERO);
|
||||
}
|
||||
parameter.setState(state);
|
||||
}
|
||||
documentDetailedService.saveBatch(list);
|
||||
document.setEquipmentInventory(checkEqpInv(document.getActivityId()));
|
||||
this.save(document);
|
||||
} else {
|
||||
for (DocumentDetailed parameter : list) {
|
||||
Document document_ = this.getById(Document.genHandle(site, parameter.getDocumentNo()));
|
||||
if (!"SAVE".equals(document_.getState())) {
|
||||
throw BusinessException.build("单据状态发生改变,请先检索后操作");
|
||||
}
|
||||
String state = document.getState();
|
||||
for (DocumentDetailed parameter : list) {
|
||||
parameter.setDocumentType(documentType);
|
||||
parameter.setDocumentNo(documentNo);
|
||||
parameter.setHandle(DocumentDetailed.genHandle(parameter.getDocumentNo(), parameter.getItem(), parameter.getSeq()));
|
||||
parameter.setCreateUser(document.getCreateUser());
|
||||
parameter.setDocumentBo(document.getHandle());
|
||||
parameter.setSite(site);
|
||||
parameter.setCreateDate(document.getCreateDate());
|
||||
if ("REJECT".equals(parameter.getState())) {
|
||||
parameter.setActualQuantity(BigDecimal.ZERO);
|
||||
}
|
||||
parameter.setState(state);
|
||||
}
|
||||
documentDetailedService.saveBatch(list);
|
||||
document.setEquipmentInventory(checkEqpInv(document.getActivityId()));
|
||||
this.save(document);
|
||||
} else {
|
||||
for (DocumentDetailed parameter : list) {
|
||||
Document document_ = this.getById(Document.genHandle(site, parameter.getDocumentNo()));
|
||||
if (!"SAVE".equals(document_.getState())) {
|
||||
throw BusinessException.build("单据状态发生改变,请先检索后操作");
|
||||
}
|
||||
parameter.setUpdateUser(user);
|
||||
parameter.setUpdateDate(now);
|
||||
}
|
||||
documentDetailedService.updateBatchById(list);
|
||||
}
|
||||
return documentDetailedService.list(Wrappers.lambdaQuery(DocumentDetailed.class).eq(DocumentDetailed::getSite, site).in(DocumentDetailed::getDocumentNo, list.stream().map(DocumentDetailed::getDocumentNo).collect(Collectors.toList())));}
|
||||
parameter.setUpdateDate(now);
|
||||
}
|
||||
documentDetailedService.updateBatchById(list);
|
||||
}
|
||||
return documentDetailedService.list(Wrappers.lambdaQuery(DocumentDetailed.class).eq(DocumentDetailed::getSite, site).in(DocumentDetailed::getDocumentNo, list.stream().map(DocumentDetailed::getDocumentNo).collect(Collectors.toList())));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void testPrint(String documentNo) {
|
||||
String site = TenantContextHolder.getTenantStrId();
|
||||
String fileName = documentNo + ".pdf";
|
||||
Document document1 = super.getById(Document.genHandle(site, documentNo));
|
||||
public void testPrint(String documentNo) {
|
||||
String site = TenantContextHolder.getTenantStrId();
|
||||
String fileName = documentNo + ".pdf";
|
||||
Document document1 = super.getById(Document.genHandle(site, documentNo));
|
||||
|
||||
R<List<SysTenant>> listR = remoteTenantService.list(SecurityConstants.FROM_IN);
|
||||
String siteDescription = "";
|
||||
for (SysTenant t : listR.getData()) {
|
||||
if (site.equals(t.getCode())) {
|
||||
siteDescription = t.getName();
|
||||
break;
|
||||
}
|
||||
}
|
||||
document1.setDocumentDetailedList(documentDetailedMapper.selecttable(documentNo, site));
|
||||
List<DocumentDetailed> documentDetailedList = document1.getDocumentDetailedList();
|
||||
LocalDateTime createDateTime = documentDetailedList.get(0).getCreateDate();
|
||||
String date = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").format(createDateTime);
|
||||
String name = documentMapper.selectUsrName(site, documentDetailedList.get(0).getCreateUser());
|
||||
String vendorName = null;
|
||||
R<List<SysTenant>> listR = remoteTenantService.list(SecurityConstants.FROM_IN);
|
||||
String siteDescription = "";
|
||||
for (SysTenant t : listR.getData()) {
|
||||
if (site.equals(t.getCode())) {
|
||||
siteDescription = t.getName();
|
||||
break;
|
||||
}
|
||||
}
|
||||
document1.setDocumentDetailedList(documentDetailedMapper.selecttable(documentNo, site));
|
||||
List<DocumentDetailed> documentDetailedList = document1.getDocumentDetailedList();
|
||||
LocalDateTime createDateTime = documentDetailedList.get(0).getCreateDate();
|
||||
String date = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").format(createDateTime);
|
||||
String name = documentMapper.selectUsrName(site, documentDetailedList.get(0).getCreateUser());
|
||||
String vendorName = null;
|
||||
// if (Constant.DOCUMENT_PROCUREMENT_STORAGE.equals(document1.getDocumentType()) || Constant.DOCUMENT_PURCHASE_RETURN.equals(document1.getDocumentType())) {
|
||||
// String externalDocumentNo = document1.getExternalDocumentNo();
|
||||
// PoOrder poOrder = poOrderService.getOne(Wrappers.lambdaQuery(PoOrder.class).eq(PoOrder::getHandle, com.foreverwin.mom.wms.enums.HandleEnum.WMS_PO_ORDER.getHandle(site, externalDocumentNo)).select(PoOrder::getCustomerNo));
|
||||
@ -3881,19 +3882,19 @@ public class DocumentServiceImpl extends ServiceImpl<DocumentMapper, Document> i
|
||||
// }
|
||||
// }
|
||||
|
||||
com.itextpdf.text.Document document = new com.itextpdf.text.Document();
|
||||
try {
|
||||
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
||||
HttpServletResponse response = attributes.getResponse();
|
||||
response.setCharacterEncoding("utf-8");
|
||||
response.setContentType("application/pdf");
|
||||
response.setHeader("Content-Disposition", "inline;filename=" + fileName);
|
||||
response.flushBuffer();
|
||||
ServletOutputStream outputStream = response.getOutputStream();
|
||||
PdfWriter.getInstance(document, outputStream);
|
||||
document.open();
|
||||
com.itextpdf.text.Document document = new com.itextpdf.text.Document();
|
||||
try {
|
||||
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
||||
HttpServletResponse response = attributes.getResponse();
|
||||
response.setCharacterEncoding("utf-8");
|
||||
response.setContentType("application/pdf");
|
||||
response.setHeader("Content-Disposition", "inline;filename=" + fileName);
|
||||
response.flushBuffer();
|
||||
ServletOutputStream outputStream = response.getOutputStream();
|
||||
PdfWriter.getInstance(document, outputStream);
|
||||
document.open();
|
||||
|
||||
//打包部署到 docker 容器后 获取不到静态资源
|
||||
//打包部署到 docker 容器后 获取不到静态资源
|
||||
// ClassPathResource resource = new ClassPathResource("static/image/img.png");
|
||||
// InputStream is = resource.getInputStream();
|
||||
// ByteArrayOutputStream swapStream = new ByteArrayOutputStream();
|
||||
@ -3906,154 +3907,154 @@ public class DocumentServiceImpl extends ServiceImpl<DocumentMapper, Document> i
|
||||
// image.setAlignment(com.itextpdf.text.Image.ALIGN_LEFT);
|
||||
// image.scalePercent(40); //依照比例缩放
|
||||
|
||||
//选择条形码类型(好多类型可供选择)
|
||||
//EAN128Bean bean = new EAN128Bean();
|
||||
Code128Bean bean = new Code128Bean();
|
||||
//Code39Bean bean = new Code39Bean();
|
||||
//设置长宽
|
||||
final int resolution = 150;
|
||||
final double moduleWidth = UnitConv.in2mm(3.0f / resolution);
|
||||
bean.setModuleWidth(moduleWidth);
|
||||
//bean.setWideFactor(3);
|
||||
bean.doQuietZone(false);
|
||||
String format = "image/png";
|
||||
ByteBuffer buffer = new ByteBuffer();
|
||||
// 输出流
|
||||
BitmapCanvasProvider canvas = new BitmapCanvasProvider(buffer, format,
|
||||
resolution, BufferedImage.TYPE_BYTE_BINARY, false, 0);
|
||||
//生成条码
|
||||
bean.generateBarcode(canvas, documentNo);
|
||||
canvas.finish();
|
||||
com.itextpdf.text.Image barCodeImage = com.itextpdf.text.Image.getInstance(buffer.toByteArray());
|
||||
barCodeImage.setAlignment(com.itextpdf.text.Image.ALIGN_LEFT);
|
||||
barCodeImage.scalePercent(40); //依照比例缩放
|
||||
//选择条形码类型(好多类型可供选择)
|
||||
//EAN128Bean bean = new EAN128Bean();
|
||||
Code128Bean bean = new Code128Bean();
|
||||
//Code39Bean bean = new Code39Bean();
|
||||
//设置长宽
|
||||
final int resolution = 150;
|
||||
final double moduleWidth = UnitConv.in2mm(3.0f / resolution);
|
||||
bean.setModuleWidth(moduleWidth);
|
||||
//bean.setWideFactor(3);
|
||||
bean.doQuietZone(false);
|
||||
String format = "image/png";
|
||||
ByteBuffer buffer = new ByteBuffer();
|
||||
// 输出流
|
||||
BitmapCanvasProvider canvas = new BitmapCanvasProvider(buffer, format,
|
||||
resolution, BufferedImage.TYPE_BYTE_BINARY, false, 0);
|
||||
//生成条码
|
||||
bean.generateBarcode(canvas, documentNo);
|
||||
canvas.finish();
|
||||
com.itextpdf.text.Image barCodeImage = com.itextpdf.text.Image.getInstance(buffer.toByteArray());
|
||||
barCodeImage.setAlignment(com.itextpdf.text.Image.ALIGN_LEFT);
|
||||
barCodeImage.scalePercent(40); //依照比例缩放
|
||||
|
||||
PdfPTable table = new PdfPTable(9);
|
||||
PdfPTable table1 = new PdfPTable(3);
|
||||
PdfPTable table2 = new PdfPTable(2);
|
||||
PdfPTable table = new PdfPTable(9);
|
||||
PdfPTable table1 = new PdfPTable(3);
|
||||
PdfPTable table2 = new PdfPTable(2);
|
||||
|
||||
BaseFont bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);
|
||||
//字体
|
||||
com.itextpdf.text.Font font = new com.itextpdf.text.Font(bfChinese, 8, com.itextpdf.text.Font.NORMAL);
|
||||
com.itextpdf.text.Font pFont = new com.itextpdf.text.Font(bfChinese, 16, com.itextpdf.text.Font.NORMAL);
|
||||
com.itextpdf.text.Font nFont = new com.itextpdf.text.Font(bfChinese, 9, com.itextpdf.text.Font.NORMAL);
|
||||
com.itextpdf.text.Font hFont = new com.itextpdf.text.Font(bfChinese, 10, com.itextpdf.text.Font.BOLD);
|
||||
BaseFont bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);
|
||||
//字体
|
||||
com.itextpdf.text.Font font = new com.itextpdf.text.Font(bfChinese, 8, com.itextpdf.text.Font.NORMAL);
|
||||
com.itextpdf.text.Font pFont = new com.itextpdf.text.Font(bfChinese, 16, com.itextpdf.text.Font.NORMAL);
|
||||
com.itextpdf.text.Font nFont = new com.itextpdf.text.Font(bfChinese, 9, com.itextpdf.text.Font.NORMAL);
|
||||
com.itextpdf.text.Font hFont = new com.itextpdf.text.Font(bfChinese, 10, com.itextpdf.text.Font.BOLD);
|
||||
|
||||
PdfPCell cell = null;
|
||||
//头图片条码表格
|
||||
PdfPTable tableHead = new PdfPTable(2);
|
||||
tableHead.setHorizontalAlignment(Element.ALIGN_CENTER);
|
||||
PdfPCell cell = null;
|
||||
//头图片条码表格
|
||||
PdfPTable tableHead = new PdfPTable(2);
|
||||
tableHead.setHorizontalAlignment(Element.ALIGN_CENTER);
|
||||
|
||||
tableHead.setWidthPercentage(100);
|
||||
tableHead.setWidthPercentage(100);
|
||||
// cell = new PdfPCell(image);
|
||||
cell = new PdfPCell();
|
||||
cell.setHorizontalAlignment(Element.ALIGN_LEFT);
|
||||
cell.disableBorderSide(15);
|
||||
tableHead.addCell(cell);
|
||||
cell = new PdfPCell(barCodeImage);
|
||||
cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
|
||||
cell.disableBorderSide(15);
|
||||
tableHead.addCell(cell);
|
||||
cell = new PdfPCell();
|
||||
cell.setHorizontalAlignment(Element.ALIGN_LEFT);
|
||||
cell.disableBorderSide(15);
|
||||
tableHead.addCell(cell);
|
||||
cell = new PdfPCell(barCodeImage);
|
||||
cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
|
||||
cell.disableBorderSide(15);
|
||||
tableHead.addCell(cell);
|
||||
|
||||
String dataField = documentDetailedList.get(0).getDocumentType();
|
||||
String description = documentMapper.selectDataField(dataField, site);
|
||||
String dataField = documentDetailedList.get(0).getDocumentType();
|
||||
String description = documentMapper.selectDataField(dataField, site);
|
||||
|
||||
table1.addCell(createCell("站点:" + siteDescription, hFont, Element.ALIGN_LEFT, 1.5f, 1.5f));
|
||||
table1.addCell(createCell("制单人:" + name, hFont, Element.ALIGN_LEFT, 1.5f, 1.5f));
|
||||
table1.addCell(createCell("创建时间:" + date, hFont, Element.ALIGN_LEFT, 1.5f, 1.5f));
|
||||
table1.addCell(createCell("ERP单据号:" + Optional.ofNullable(document1.getExternalDocumentNo()).orElse(""), hFont, Element.ALIGN_LEFT, 1.5f, 1.5f));
|
||||
if (StrUtil.isNotBlank(vendorName)) {
|
||||
PdfPCell cell1 = createCell("供应商:" + vendorName, hFont, Element.ALIGN_LEFT, 1.5f, 1.5f);
|
||||
cell1.setColspan(2);
|
||||
table1.addCell(cell1);
|
||||
table1.addCell(createCell("备注:", hFont, Element.ALIGN_LEFT, 1.5f, 1.5f));
|
||||
table1.addCell(createCell(" ", hFont, Element.ALIGN_LEFT, 1.5f, 1.5f));
|
||||
table1.addCell(createCell(" ", hFont, Element.ALIGN_LEFT, 1.5f, 1.5f));
|
||||
} else {
|
||||
table1.addCell(createCell("备注:", hFont, Element.ALIGN_LEFT, 1.5f, 1.5f));
|
||||
table1.addCell(createCell(" ", hFont, Element.ALIGN_LEFT, 1.5f, 1.5f));
|
||||
}
|
||||
if (!Constant.DOCUMENT_PROCUREMENT_STORAGE.equals(document1.getDocumentType())) {
|
||||
table2.addCell(createCell("审批人:", hFont, Element.ALIGN_LEFT, 1.5f, 1.5f));
|
||||
table2.addCell(createCell("审批时间:", hFont, Element.ALIGN_LEFT, 1.5f, 1.5f));
|
||||
table2.addCell(createCell("执行人:", hFont, Element.ALIGN_LEFT, 1.5f, 1.5f));
|
||||
table2.addCell(createCell("执行时间:", hFont, Element.ALIGN_LEFT, 1.5f, 1.5f));
|
||||
}
|
||||
table1.addCell(createCell("站点:" + siteDescription, hFont, Element.ALIGN_LEFT, 1.5f, 1.5f));
|
||||
table1.addCell(createCell("制单人:" + name, hFont, Element.ALIGN_LEFT, 1.5f, 1.5f));
|
||||
table1.addCell(createCell("创建时间:" + date, hFont, Element.ALIGN_LEFT, 1.5f, 1.5f));
|
||||
table1.addCell(createCell("ERP单据号:" + Optional.ofNullable(document1.getExternalDocumentNo()).orElse(""), hFont, Element.ALIGN_LEFT, 1.5f, 1.5f));
|
||||
if (StrUtil.isNotBlank(vendorName)) {
|
||||
PdfPCell cell1 = createCell("供应商:" + vendorName, hFont, Element.ALIGN_LEFT, 1.5f, 1.5f);
|
||||
cell1.setColspan(2);
|
||||
table1.addCell(cell1);
|
||||
table1.addCell(createCell("备注:", hFont, Element.ALIGN_LEFT, 1.5f, 1.5f));
|
||||
table1.addCell(createCell(" ", hFont, Element.ALIGN_LEFT, 1.5f, 1.5f));
|
||||
table1.addCell(createCell(" ", hFont, Element.ALIGN_LEFT, 1.5f, 1.5f));
|
||||
} else {
|
||||
table1.addCell(createCell("备注:", hFont, Element.ALIGN_LEFT, 1.5f, 1.5f));
|
||||
table1.addCell(createCell(" ", hFont, Element.ALIGN_LEFT, 1.5f, 1.5f));
|
||||
}
|
||||
if (!Constant.DOCUMENT_PROCUREMENT_STORAGE.equals(document1.getDocumentType())) {
|
||||
table2.addCell(createCell("审批人:", hFont, Element.ALIGN_LEFT, 1.5f, 1.5f));
|
||||
table2.addCell(createCell("审批时间:", hFont, Element.ALIGN_LEFT, 1.5f, 1.5f));
|
||||
table2.addCell(createCell("执行人:", hFont, Element.ALIGN_LEFT, 1.5f, 1.5f));
|
||||
table2.addCell(createCell("执行时间:", hFont, Element.ALIGN_LEFT, 1.5f, 1.5f));
|
||||
}
|
||||
|
||||
Paragraph paragraph = new Paragraph(description, pFont);
|
||||
Paragraph paragraph1 = new Paragraph(" ", font);
|
||||
paragraph.setAlignment(1); //设置文字居中 0靠左 1,居中 2,靠右
|
||||
Paragraph paragraph = new Paragraph(description, pFont);
|
||||
Paragraph paragraph1 = new Paragraph(" ", font);
|
||||
paragraph.setAlignment(1); //设置文字居中 0靠左 1,居中 2,靠右
|
||||
|
||||
table.setWidths(new int[]{45, 70, 70, 30, 45, 45, 45, 45, 55});
|
||||
table.addCell(createCell1("单据状态", nFont, Element.ALIGN_CENTER));
|
||||
table.addCell(createCell1("物料", nFont, Element.ALIGN_CENTER));
|
||||
table.addCell(createCell1("物料描述", nFont, Element.ALIGN_CENTER));
|
||||
table.addCell(createCell1("单位", nFont, Element.ALIGN_CENTER));
|
||||
table.addCell(createCell1("申请数量", nFont, Element.ALIGN_CENTER));
|
||||
table.addCell(createCell1("实际数量", nFont, Element.ALIGN_CENTER));
|
||||
table.addCell(createCell1("来源库存", nFont, Element.ALIGN_CENTER));
|
||||
table.addCell(createCell1("目标库存", nFont, Element.ALIGN_CENTER));
|
||||
table.addCell(createCell1("备注", nFont, Element.ALIGN_CENTER));
|
||||
table.setWidths(new int[]{45, 70, 70, 30, 45, 45, 45, 45, 55});
|
||||
table.addCell(createCell1("单据状态", nFont, Element.ALIGN_CENTER));
|
||||
table.addCell(createCell1("物料", nFont, Element.ALIGN_CENTER));
|
||||
table.addCell(createCell1("物料描述", nFont, Element.ALIGN_CENTER));
|
||||
table.addCell(createCell1("单位", nFont, Element.ALIGN_CENTER));
|
||||
table.addCell(createCell1("申请数量", nFont, Element.ALIGN_CENTER));
|
||||
table.addCell(createCell1("实际数量", nFont, Element.ALIGN_CENTER));
|
||||
table.addCell(createCell1("来源库存", nFont, Element.ALIGN_CENTER));
|
||||
table.addCell(createCell1("目标库存", nFont, Element.ALIGN_CENTER));
|
||||
table.addCell(createCell1("备注", nFont, Element.ALIGN_CENTER));
|
||||
|
||||
for (DocumentDetailed parameter : documentDetailedList) {
|
||||
String state = parameter.getState();
|
||||
if (state == "SAVE" || "SAVE".equals(state)) {
|
||||
parameter.setState("保存");
|
||||
}
|
||||
if (state == "SUBMIT" || "SUBMIT".equals(state)) {
|
||||
parameter.setState("提交");
|
||||
}
|
||||
if (state == "CLOSE" || "CLOSE".equals(state)) {
|
||||
parameter.setState("关闭");
|
||||
}
|
||||
if (state == "CANCEL" || "CANCEL".equals(state)) {
|
||||
parameter.setState("取消");
|
||||
}
|
||||
if ("REJECT".equals(state)) {
|
||||
parameter.setState("拒收");
|
||||
}
|
||||
for (DocumentDetailed parameter : documentDetailedList) {
|
||||
String state = parameter.getState();
|
||||
if (state == "SAVE" || "SAVE".equals(state)) {
|
||||
parameter.setState("保存");
|
||||
}
|
||||
if (state == "SUBMIT" || "SUBMIT".equals(state)) {
|
||||
parameter.setState("提交");
|
||||
}
|
||||
if (state == "CLOSE" || "CLOSE".equals(state)) {
|
||||
parameter.setState("关闭");
|
||||
}
|
||||
if (state == "CANCEL" || "CANCEL".equals(state)) {
|
||||
parameter.setState("取消");
|
||||
}
|
||||
if ("REJECT".equals(state)) {
|
||||
parameter.setState("拒收");
|
||||
}
|
||||
|
||||
table.addCell(createCell1(parameter.getState(), font, Element.ALIGN_CENTER));
|
||||
table.addCell(createCell1(parameter.getItem(), font, Element.ALIGN_CENTER));
|
||||
table.addCell(createCell1(parameter.getItemDescription(), font, Element.ALIGN_CENTER));
|
||||
table.addCell(createCell1(parameter.getUnitOfMeasure(), font, Element.ALIGN_CENTER));
|
||||
table.addCell(createCell1(parameter.getApplicationsQuantity().setScale(4, BigDecimal.ROUND_HALF_UP).stripTrailingZeros().toPlainString(), font, Element.ALIGN_CENTER));
|
||||
if (parameter.getActualQuantity() == null) {
|
||||
table.addCell(createCell1("", font, Element.ALIGN_CENTER));
|
||||
} else {
|
||||
table.addCell(createCell1(parameter.getActualQuantity().setScale(4, BigDecimal.ROUND_HALF_UP).stripTrailingZeros().toPlainString(), font, Element.ALIGN_CENTER));
|
||||
}
|
||||
table.addCell(createCell1(parameter.getSourceWarehouse(), font, Element.ALIGN_CENTER));
|
||||
table.addCell(createCell1(parameter.getTargetWarehouse(), font, Element.ALIGN_CENTER));
|
||||
table.addCell(createCell1(parameter.getRemarks(), font, Element.ALIGN_CENTER));
|
||||
}
|
||||
for (int i = 0; i < 17 - documentDetailedList.size(); i++) {
|
||||
table.addCell(createCell1(" ", font, Element.ALIGN_CENTER));
|
||||
table.addCell(createCell1(" ", font, Element.ALIGN_CENTER));
|
||||
table.addCell(createCell1(" ", font, Element.ALIGN_CENTER));
|
||||
table.addCell(createCell1(" ", font, Element.ALIGN_CENTER));
|
||||
table.addCell(createCell1(" ", font, Element.ALIGN_CENTER));
|
||||
table.addCell(createCell1(" ", font, Element.ALIGN_CENTER));
|
||||
table.addCell(createCell1(" ", font, Element.ALIGN_CENTER));
|
||||
table.addCell(createCell1(" ", font, Element.ALIGN_CENTER));
|
||||
table.addCell(createCell1(" ", font, Element.ALIGN_CENTER));
|
||||
}
|
||||
//document.add(image);
|
||||
document.add(tableHead);
|
||||
document.add(paragraph);
|
||||
document.add(paragraph1);
|
||||
document.add(table1);
|
||||
document.add(paragraph1);
|
||||
document.add(table);
|
||||
document.add(paragraph1);
|
||||
document.add(table2);
|
||||
table.addCell(createCell1(parameter.getState(), font, Element.ALIGN_CENTER));
|
||||
table.addCell(createCell1(parameter.getItem(), font, Element.ALIGN_CENTER));
|
||||
table.addCell(createCell1(parameter.getItemDescription(), font, Element.ALIGN_CENTER));
|
||||
table.addCell(createCell1(parameter.getUnitOfMeasure(), font, Element.ALIGN_CENTER));
|
||||
table.addCell(createCell1(parameter.getApplicationsQuantity().setScale(4, BigDecimal.ROUND_HALF_UP).stripTrailingZeros().toPlainString(), font, Element.ALIGN_CENTER));
|
||||
if (parameter.getActualQuantity() == null) {
|
||||
table.addCell(createCell1("", font, Element.ALIGN_CENTER));
|
||||
} else {
|
||||
table.addCell(createCell1(parameter.getActualQuantity().setScale(4, BigDecimal.ROUND_HALF_UP).stripTrailingZeros().toPlainString(), font, Element.ALIGN_CENTER));
|
||||
}
|
||||
table.addCell(createCell1(parameter.getSourceWarehouse(), font, Element.ALIGN_CENTER));
|
||||
table.addCell(createCell1(parameter.getTargetWarehouse(), font, Element.ALIGN_CENTER));
|
||||
table.addCell(createCell1(parameter.getRemarks(), font, Element.ALIGN_CENTER));
|
||||
}
|
||||
for (int i = 0; i < 17 - documentDetailedList.size(); i++) {
|
||||
table.addCell(createCell1(" ", font, Element.ALIGN_CENTER));
|
||||
table.addCell(createCell1(" ", font, Element.ALIGN_CENTER));
|
||||
table.addCell(createCell1(" ", font, Element.ALIGN_CENTER));
|
||||
table.addCell(createCell1(" ", font, Element.ALIGN_CENTER));
|
||||
table.addCell(createCell1(" ", font, Element.ALIGN_CENTER));
|
||||
table.addCell(createCell1(" ", font, Element.ALIGN_CENTER));
|
||||
table.addCell(createCell1(" ", font, Element.ALIGN_CENTER));
|
||||
table.addCell(createCell1(" ", font, Element.ALIGN_CENTER));
|
||||
table.addCell(createCell1(" ", font, Element.ALIGN_CENTER));
|
||||
}
|
||||
//document.add(image);
|
||||
document.add(tableHead);
|
||||
document.add(paragraph);
|
||||
document.add(paragraph1);
|
||||
document.add(table1);
|
||||
document.add(paragraph1);
|
||||
document.add(table);
|
||||
document.add(paragraph1);
|
||||
document.add(table2);
|
||||
|
||||
document.close();
|
||||
outputStream.flush();
|
||||
} catch (Exception e) {
|
||||
throw BusinessException.build(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
document.close();
|
||||
outputStream.flush();
|
||||
} catch (Exception e) {
|
||||
throw BusinessException.build(e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
@ -4105,7 +4106,7 @@ public class DocumentServiceImpl extends ServiceImpl<DocumentMapper, Document> i
|
||||
document.setEquipmentInventory(checkEqpInv(activityId));
|
||||
this.save(document);
|
||||
}
|
||||
|
||||
|
||||
// 提交时根据不通的单据类型进行校验
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
List<DocumentDetailed> allDetaildList = new ArrayList<>();
|
||||
@ -4124,7 +4125,7 @@ public class DocumentServiceImpl extends ServiceImpl<DocumentMapper, Document> i
|
||||
if ("REJECT".equals(document_.getState())) {
|
||||
throw BusinessException.build(MessageFormat.format("单据{0}已经拒收不可再次提交", document.getDocumentNo()));
|
||||
}
|
||||
|
||||
|
||||
// 销售出货 额外校验逻辑
|
||||
if (Constant.DOCUMENT_SALES_OUT.equals(document.getDocumentType())) {
|
||||
DnOrder dnOrder = Optional.ofNullable(dnOrderService.getOne(Wrappers.lambdaQuery(DnOrder.class).eq(DnOrder::getSite, site).eq(DnOrder::getDnNumber, document_.getExternalDocumentNo()).select(DnOrder::getDeliveryParty)))
|
||||
@ -4427,9 +4428,9 @@ public class DocumentServiceImpl extends ServiceImpl<DocumentMapper, Document> i
|
||||
// detailed.setUpdateDate(now);
|
||||
// }
|
||||
// } else {
|
||||
detailed.setState("SUBMIT");
|
||||
detailed.setUpdateUser(user);
|
||||
detailed.setUpdateDate(now);
|
||||
detailed.setState("SUBMIT");
|
||||
detailed.setUpdateUser(user);
|
||||
detailed.setUpdateDate(now);
|
||||
// }
|
||||
|
||||
//采购到货创建库存
|
||||
@ -4809,10 +4810,10 @@ public class DocumentServiceImpl extends ServiceImpl<DocumentMapper, Document> i
|
||||
public void checkCarrierFifo(String site, List<String> carrierList, boolean exceptPicking) {
|
||||
List<String> carrierBoList = carrierList.stream().map(o -> Carrier.genHandle(site, o)).collect(Collectors.toList());
|
||||
Map<String, Long> scanCarrierCountMap = wmsCarrierMemberService.list(Wrappers.lambdaQuery(CarrierMember.class)
|
||||
.in(CarrierMember::getCarrierBo, carrierBoList)
|
||||
.isNotNull(CarrierMember::getItem)
|
||||
.isNotNull(CarrierMember::getEarliestProductionDate)
|
||||
.orderByAsc(CarrierMember::getEarliestProductionDate))
|
||||
.in(CarrierMember::getCarrierBo, carrierBoList)
|
||||
.isNotNull(CarrierMember::getItem)
|
||||
.isNotNull(CarrierMember::getEarliestProductionDate)
|
||||
.orderByAsc(CarrierMember::getEarliestProductionDate))
|
||||
.stream()
|
||||
.collect(Collectors.groupingBy(o -> o.getEarliestProductionDate().concat("$").concat(o.getItem()), LinkedHashMap::new, Collectors.counting()));
|
||||
if (scanCarrierCountMap.size() > 0) {
|
||||
@ -4823,12 +4824,12 @@ public class DocumentServiceImpl extends ServiceImpl<DocumentMapper, Document> i
|
||||
//获取拣货表
|
||||
List<String> pickingCarrierList = exceptPicking ? pickingService.selectPickingCarrier(site, lastKey[1]) : null;
|
||||
Map<String, Long> fifoCarrierCountMap = wmsCarrierMemberService.list(Wrappers.lambdaQuery(CarrierMember.class)
|
||||
.eq(CarrierMember::getItem, lastKey[1])
|
||||
.notIn(exceptPicking && CollectionUtil.isNotEmpty(pickingCarrierList), CarrierMember::getCarrierBo, pickingCarrierList) //忽略拣货表
|
||||
.le(CarrierMember::getEarliestProductionDate, lastKey[0])
|
||||
.and(qw -> qw.isNull(CarrierMember::getFrozenState).or().ne(CarrierMember::getFrozenState, "Y"))
|
||||
.select(CarrierMember::getHandle, CarrierMember::getItem, CarrierMember::getEarliestProductionDate)
|
||||
.orderByAsc(CarrierMember::getEarliestProductionDate))
|
||||
.eq(CarrierMember::getItem, lastKey[1])
|
||||
.notIn(exceptPicking && CollectionUtil.isNotEmpty(pickingCarrierList), CarrierMember::getCarrierBo, pickingCarrierList) //忽略拣货表
|
||||
.le(CarrierMember::getEarliestProductionDate, lastKey[0])
|
||||
.and(qw -> qw.isNull(CarrierMember::getFrozenState).or().ne(CarrierMember::getFrozenState, "Y"))
|
||||
.select(CarrierMember::getHandle, CarrierMember::getItem, CarrierMember::getEarliestProductionDate)
|
||||
.orderByAsc(CarrierMember::getEarliestProductionDate))
|
||||
.stream()
|
||||
.collect(Collectors.groupingBy(o -> o.getEarliestProductionDate().concat("$").concat(o.getItem()), LinkedHashMap::new, Collectors.counting()));
|
||||
//遍历Map
|
||||
@ -6255,7 +6256,7 @@ public class DocumentServiceImpl extends ServiceImpl<DocumentMapper, Document> i
|
||||
@Override
|
||||
public List<DocumentDetailed> getSubmitDocumentDetail(String site, String documentNo) {
|
||||
Document byId = getDocument(site, documentNo);
|
||||
if (!(Constant.DOCUMENT_STATUS_SUBMIT.equals(byId.getState()) || Constant.DOCUMENT_STATUS_CLOSE.equals(byId.getState()))) {
|
||||
if (!(Constant.DOCUMENT_STATUS_SUBMIT.equals(byId.getState()) || Constant.DOCUMENT_STATUS_PICKING.equals(byId.getState()) || Constant.DOCUMENT_STATUS_TBC.equals(byId.getState()) || Constant.DOCUMENT_STATUS_POST.equals(byId.getState()) || Constant.DOCUMENT_STATUS_CLOSE.equals(byId.getState()))) {
|
||||
throw BusinessException.build("此单据状态未提交");
|
||||
} else {
|
||||
return getDocumentDetail(site, documentNo);
|
||||
@ -6268,14 +6269,7 @@ public class DocumentServiceImpl extends ServiceImpl<DocumentMapper, Document> i
|
||||
}
|
||||
|
||||
private List<DocumentDetailed> getDocumentDetail(String site, String documentNo) {
|
||||
return documentDetailedService.lambdaQuery().eq(DocumentDetailed::getDocumentBo, Document.genHandle(site, documentNo))
|
||||
.select(DocumentDetailed::getItem
|
||||
, DocumentDetailed::getItemDescription
|
||||
, DocumentDetailed::getSourceWarehouse
|
||||
, DocumentDetailed::getTargetWarehouse
|
||||
, DocumentDetailed::getApplicationsQuantity
|
||||
, DocumentDetailed::getState
|
||||
).orderByAsc(DocumentDetailed::getSeq).list();
|
||||
return documentDetailedService.lambdaQuery().eq(DocumentDetailed::getDocumentBo, Document.genHandle(site, documentNo)).orderByAsc(DocumentDetailed::getSeq).list();
|
||||
}
|
||||
|
||||
private void updateDocumentAndDetailStatus(String user, String documentBo, LocalDateTime localDateTime, String status) {
|
||||
@ -6307,9 +6301,13 @@ public class DocumentServiceImpl extends ServiceImpl<DocumentMapper, Document> i
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ScanCodeDTO> scanCode(String site, String user, String code) {
|
||||
public List<ScanCodeDTO> scanCode(String site, String user, String code, boolean fullSearch) {
|
||||
pickingService.checkCodePicking(site, code);
|
||||
return inventoryService.selectInvByCode(site, user, code);
|
||||
List<ScanCodeDTO> scanCodeDTOS = fullSearch ? inventoryService.selectTrayInvByCode(site, user, code) : inventoryService.selectInvByCode(site, user, code);
|
||||
if (CollectionUtil.isEmpty(scanCodeDTOS)) {
|
||||
throw BusinessException.build("条码无法识别");
|
||||
}
|
||||
return scanCodeDTOS;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -6335,6 +6333,9 @@ public class DocumentServiceImpl extends ServiceImpl<DocumentMapper, Document> i
|
||||
picking.setDocumentNo(documentNo);
|
||||
picking.setPickingStatus(Constant.PICKING_STATUS_PICKING);
|
||||
picking.setSeq(seqMap.get(o.getItem()));
|
||||
picking.setItem(o.getItem());
|
||||
picking.setBatchNumber(o.getBatchNo());
|
||||
picking.setQty(o.getQty());
|
||||
picking.setDocumentType(document.getDocumentType());
|
||||
picking.setInventoryId(o.getInventoryId());
|
||||
picking.setBatchNumber(o.getBatchNo());
|
||||
@ -6441,7 +6442,7 @@ public class DocumentServiceImpl extends ServiceImpl<DocumentMapper, Document> i
|
||||
.set(Inventory::getWmsStorageBinBo, null)
|
||||
.set(Inventory::getQtyOnHand, BigDecimal.ZERO)
|
||||
.set(Inventory::getUpdateTime, now)
|
||||
.set(Inventory::getUpdater, user));
|
||||
.set(Inventory::getUpdater, user).update());
|
||||
inventoryLogService.saveBatch(inventories.stream().map(inventory -> inventoryLogService.buildLog(user, inventory.getInventoryId(), documentNo, inventory.getStatus(), document.getDocumentType(), inventory.getWmsStorageBinBo(), inventory.getQtyOnHand(), null, null, null, inventory)).collect(Collectors.toList()));
|
||||
updatePickingStatus(site, user, documentNo, now, Constant.PICKING_STATUS_CLOSE);
|
||||
documentSfcService.saveBatch(documentSfcList);
|
||||
@ -6494,7 +6495,7 @@ public class DocumentServiceImpl extends ServiceImpl<DocumentMapper, Document> i
|
||||
.set(Inventory::getErpStorageLocation, documentDetailed.getTargetWarehouse())
|
||||
.set(Inventory::getQtyOnHand, picking.getQty())
|
||||
.set(Inventory::getUpdateTime, now)
|
||||
.set(Inventory::getUpdater, user);
|
||||
.set(Inventory::getUpdater, user).update();
|
||||
}
|
||||
}
|
||||
|
||||
@ -6517,7 +6518,7 @@ public class DocumentServiceImpl extends ServiceImpl<DocumentMapper, Document> i
|
||||
String documentBo = document.getHandle();
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
if (Constant.DOCUMENT_STATUS_TBC.equals(document.getState())) {
|
||||
List<Picking> pickingList = pickingService.lambdaQuery().eq(Picking::getSite, site).eq(Picking::getDocumentNo, document).list();
|
||||
List<Picking> pickingList = pickingService.lambdaQuery().eq(Picking::getSite, site).eq(Picking::getDocumentNo, documentNo).list();
|
||||
List<String> inventoryBoList = pickingList.stream().map(o -> Inventory.genHandle(site, o.getInventoryId())).collect(Collectors.toList());
|
||||
Map<String, Inventory> inventoryMap = inventoryService.listByIds(inventoryBoList).stream().collect(Collectors.toMap(Inventory::getInventoryId, inventory -> inventory));
|
||||
if (inventoryMap.size() != pickingList.size()) {
|
||||
@ -6551,9 +6552,9 @@ public class DocumentServiceImpl extends ServiceImpl<DocumentMapper, Document> i
|
||||
Inventory inventory = inventoryMap.get(picking.getInventoryId());
|
||||
inventoryService.lambdaUpdate().eq(Inventory::getHandle, Inventory.genHandle(site, picking.getInventoryId()))
|
||||
.set(Inventory::getErpStorageLocation, documentDetailed.getTargetWarehouse())
|
||||
.set(StrUtil.isNotBlank(documentDetailed.getWmsStorageBinBo()), Inventory::getWmsStorageBinBo, documentDetailed.getWmsStorageBinBo())
|
||||
.set(Inventory::getWmsStorageBinBo, StrUtil.isNotBlank(documentDetailed.getWmsStorageBinBo()) ? documentDetailed.getWmsStorageBinBo() : null)
|
||||
.set(Inventory::getUpdateTime, now)
|
||||
.set(Inventory::getUpdater, user);
|
||||
.set(Inventory::getUpdater, user).update();
|
||||
inventoryLogs.add(inventoryLogService.buildLog(user, picking.getInventoryId(), documentNo, inventory.getStatus(), document.getDocumentType(), inventory.getWmsStorageBinBo(), inventory.getQtyOnHand(), documentDetailed.getWmsStorageBinBo(), null, null, inventory));
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,7 +5,6 @@ import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.exceptions.MybatisPlusException;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.foreverwin.mom.common.core.exception.BusinessException;
|
||||
@ -13,9 +12,12 @@ import com.foreverwin.mom.common.data.tenant.TenantContextHolder;
|
||||
import com.foreverwin.mom.common.security.util.SecurityUtils;
|
||||
import com.foreverwin.mom.wms.constant.Constant;
|
||||
import com.foreverwin.mom.wms.dto.ScanCodeDTO;
|
||||
import com.foreverwin.mom.wms.entity.*;
|
||||
import com.foreverwin.mom.wms.mapper.ZWmsStorageBinMapper;
|
||||
import com.foreverwin.mom.wms.dto.StorageBinDto;
|
||||
import com.foreverwin.mom.wms.entity.Inventory;
|
||||
import com.foreverwin.mom.wms.entity.StorageBin;
|
||||
import com.foreverwin.mom.wms.entity.StorageBinType;
|
||||
import com.foreverwin.mom.wms.entity.StorageLocation;
|
||||
import com.foreverwin.mom.wms.mapper.ZWmsStorageBinMapper;
|
||||
import com.foreverwin.mom.wms.service.*;
|
||||
import com.foreverwin.mom.wms.util.RegexUtils;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@ -40,241 +42,241 @@ import java.util.stream.Collectors;
|
||||
@RequiredArgsConstructor
|
||||
public class WmsStorageBinServiceImpl extends ServiceImpl<ZWmsStorageBinMapper, StorageBin> implements WmsStorageBinService {
|
||||
|
||||
private final WmsStorageLocationService storageLocationService;
|
||||
private final WmsStorageLocationService storageLocationService;
|
||||
|
||||
private final StorageBinTypeService storageBinTypeService;
|
||||
private final StorageBinTypeService storageBinTypeService;
|
||||
|
||||
private final ZWmsStorageBinMapper storageBinMapper;
|
||||
private final ZWmsStorageBinMapper storageBinMapper;
|
||||
|
||||
private final PickingService pickingService;
|
||||
private final PickingService pickingService;
|
||||
|
||||
private final ZWmsInventoryLogService inventoryLogService;
|
||||
private final ZWmsInventoryLogService inventoryLogService;
|
||||
|
||||
private ZWmsInventoryService inventoryService;
|
||||
private ZWmsInventoryService inventoryService;
|
||||
|
||||
@Autowired
|
||||
public void setInventoryService(@Lazy ZWmsInventoryService inventoryService) {
|
||||
this.inventoryService = inventoryService;
|
||||
}
|
||||
@Autowired
|
||||
public void setInventoryService(@Lazy ZWmsInventoryService inventoryService) {
|
||||
this.inventoryService = inventoryService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage getStorageBinPage(Page page, StorageBinDto storageBinDto) {
|
||||
String site = TenantContextHolder.getTenantId();
|
||||
storageBinDto.setSite(site);
|
||||
return storageBinMapper.getStorageBinPage(page, storageBinDto);
|
||||
}
|
||||
@Override
|
||||
public IPage getStorageBinPage(Page page, StorageBinDto storageBinDto) {
|
||||
String site = TenantContextHolder.getTenantId();
|
||||
storageBinDto.setSite(site);
|
||||
return storageBinMapper.getStorageBinPage(page, storageBinDto);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean save(StorageBinDto storageBinDto) {
|
||||
//获取当前站点
|
||||
String site = TenantContextHolder.getTenantId();
|
||||
//获取当前登陆用户
|
||||
String user = SecurityUtils.getUserName();
|
||||
//获取当前时间
|
||||
LocalDateTime localDateTime = LocalDateTime.now();
|
||||
if (StrUtil.isBlank(storageBinDto.getStorageBin())) {
|
||||
throw BusinessException.build("存储货格不能为空");
|
||||
}
|
||||
//名称中不可带中文
|
||||
if (RegexUtils.isContainsChinese(storageBinDto.getStorageBin())) {
|
||||
throw BusinessException.build("名称中不可带中文");
|
||||
}
|
||||
String handle = StorageBin.genHandle(site, storageBinDto.getStorageBin());
|
||||
StorageBin storageBin = new StorageBin();
|
||||
@Override
|
||||
public Boolean save(StorageBinDto storageBinDto) {
|
||||
//获取当前站点
|
||||
String site = TenantContextHolder.getTenantId();
|
||||
//获取当前登陆用户
|
||||
String user = SecurityUtils.getUserName();
|
||||
//获取当前时间
|
||||
LocalDateTime localDateTime = LocalDateTime.now();
|
||||
if (StrUtil.isBlank(storageBinDto.getStorageBin())) {
|
||||
throw BusinessException.build("存储货格不能为空");
|
||||
}
|
||||
//名称中不可带中文
|
||||
if (RegexUtils.isContainsChinese(storageBinDto.getStorageBin())) {
|
||||
throw BusinessException.build("名称中不可带中文");
|
||||
}
|
||||
String handle = StorageBin.genHandle(site, storageBinDto.getStorageBin());
|
||||
StorageBin storageBin = new StorageBin();
|
||||
|
||||
if (!StrUtil.isBlank(storageBinDto.getStorageLocation()) && StrUtil.isBlank(storageBinDto.getStorageLocationBo())) {
|
||||
String s = StorageLocation.genHandle(site, storageBinDto.getStorageLocation());
|
||||
StorageLocation byId = storageLocationService.getById(s);
|
||||
if (byId == null) {
|
||||
throw BusinessException.build("不存在此存储位置");
|
||||
}
|
||||
storageBinDto.setStorageLocationBo(byId.getHandle());
|
||||
}
|
||||
BeanUtils.copyProperties(this.validate(storageBinDto, site), storageBin);
|
||||
storageBin.setHandle(handle);
|
||||
storageBin.setSite(site);
|
||||
storageBin.setCreateTime(localDateTime);
|
||||
storageBin.setCreator(user);
|
||||
storageBin.setStatus(StorageBin.STATUS_Y);
|
||||
try {
|
||||
return super.save(storageBin);
|
||||
} catch (Exception e) {
|
||||
if (e instanceof SQLIntegrityConstraintViolationException || e instanceof DuplicateKeyException) {
|
||||
throw new MybatisPlusException("此存储位置已存在");
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!StrUtil.isBlank(storageBinDto.getStorageLocation()) && StrUtil.isBlank(storageBinDto.getStorageLocationBo())) {
|
||||
String s = StorageLocation.genHandle(site, storageBinDto.getStorageLocation());
|
||||
StorageLocation byId = storageLocationService.getById(s);
|
||||
if (byId == null) {
|
||||
throw BusinessException.build("不存在此存储位置");
|
||||
}
|
||||
storageBinDto.setStorageLocationBo(byId.getHandle());
|
||||
}
|
||||
BeanUtils.copyProperties(this.validate(storageBinDto, site), storageBin);
|
||||
storageBin.setHandle(handle);
|
||||
storageBin.setSite(site);
|
||||
storageBin.setCreateTime(localDateTime);
|
||||
storageBin.setCreator(user);
|
||||
storageBin.setStatus(StorageBin.STATUS_Y);
|
||||
try {
|
||||
return super.save(storageBin);
|
||||
} catch (Exception e) {
|
||||
if (e instanceof SQLIntegrityConstraintViolationException || e instanceof DuplicateKeyException) {
|
||||
throw new MybatisPlusException("此存储位置已存在");
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean updateById(StorageBinDto storageBinDto) {
|
||||
String user = SecurityUtils.getUserName();
|
||||
String site = TenantContextHolder.getTenantId();
|
||||
LocalDateTime localDateTime = LocalDateTime.now();
|
||||
String handle = storageBinDto.getHandle();
|
||||
StorageBin byId = this.getById(handle);
|
||||
if (!StrUtil.isBlank(storageBinDto.getStorageLocation())) {
|
||||
String s = StorageLocation.genHandle(site, storageBinDto.getStorageLocation());
|
||||
StorageLocation storageLocation = storageLocationService.getById(s);
|
||||
if (storageLocation == null) {
|
||||
throw BusinessException.build("不存在此存储位置");
|
||||
} else if (!StorageLocation.STATUS_Y.equals(storageLocation.getStatus())) {
|
||||
throw BusinessException.build(storageLocation.getStorageLocation() + "区域停用,货格不允许置为可用");
|
||||
}
|
||||
storageBinDto.setStorageLocationBo(storageLocation.getHandle());
|
||||
} else {
|
||||
storageBinDto.setStorageLocationBo("");
|
||||
}
|
||||
@Override
|
||||
public Boolean updateById(StorageBinDto storageBinDto) {
|
||||
String user = SecurityUtils.getUserName();
|
||||
String site = TenantContextHolder.getTenantId();
|
||||
LocalDateTime localDateTime = LocalDateTime.now();
|
||||
String handle = storageBinDto.getHandle();
|
||||
StorageBin byId = this.getById(handle);
|
||||
if (!StrUtil.isBlank(storageBinDto.getStorageLocation())) {
|
||||
String s = StorageLocation.genHandle(site, storageBinDto.getStorageLocation());
|
||||
StorageLocation storageLocation = storageLocationService.getById(s);
|
||||
if (storageLocation == null) {
|
||||
throw BusinessException.build("不存在此存储位置");
|
||||
} else if (!StorageLocation.STATUS_Y.equals(storageLocation.getStatus())) {
|
||||
throw BusinessException.build(storageLocation.getStorageLocation() + "区域停用,货格不允许置为可用");
|
||||
}
|
||||
storageBinDto.setStorageLocationBo(storageLocation.getHandle());
|
||||
} else {
|
||||
storageBinDto.setStorageLocationBo("");
|
||||
}
|
||||
|
||||
if (StorageBin.STATUS_N.equals(storageBinDto.getStatus())) {
|
||||
boolean exists = inventoryService.lambdaQuery().eq(Inventory::getWmsStorageBinBo, handle).exists();
|
||||
if (exists) {
|
||||
throw BusinessException.build(byId.getStorageBin() + "货格存在货物,不可停用");
|
||||
}
|
||||
}
|
||||
BeanUtils.copyProperties(this.validate(storageBinDto, site), byId);
|
||||
byId.setUpdateTime(localDateTime);
|
||||
byId.setUpdater(user);
|
||||
return super.updateById(byId);
|
||||
}
|
||||
if (StorageBin.STATUS_N.equals(storageBinDto.getStatus())) {
|
||||
boolean exists = inventoryService.lambdaQuery().eq(Inventory::getWmsStorageBinBo, handle).exists();
|
||||
if (exists) {
|
||||
throw BusinessException.build(byId.getStorageBin() + "货格存在货物,不可停用");
|
||||
}
|
||||
}
|
||||
BeanUtils.copyProperties(this.validate(storageBinDto, site), byId);
|
||||
byId.setUpdateTime(localDateTime);
|
||||
byId.setUpdater(user);
|
||||
return super.updateById(byId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String labelPrint(String site, List<StorageBin> printList, String printNumber) {
|
||||
// PrintResult printResult = null;
|
||||
String user = SecurityUtils.getUserName();
|
||||
List<Map<String, Object>> mapList = new ArrayList<>();
|
||||
for (StorageBin printDto : printList) {
|
||||
String storageBin = printDto.getStorageBin();
|
||||
String handle = StorageBin.genHandle(site, storageBin);
|
||||
StorageBin byId = this.getById(handle);
|
||||
if (byId == null) {
|
||||
throw BusinessException.build("存储货格" + storageBin + "不存在");
|
||||
}
|
||||
Map<String, Object> dataMap = new HashMap();
|
||||
dataMap.put("storageNo", storageBin);
|
||||
dataMap.put("description", byId.getDescription());
|
||||
mapList.add(dataMap);
|
||||
}
|
||||
@Override
|
||||
public String labelPrint(String site, List<StorageBin> printList, String printNumber) {
|
||||
// PrintResult printResult = null;
|
||||
String user = SecurityUtils.getUserName();
|
||||
List<Map<String, Object>> mapList = new ArrayList<>();
|
||||
for (StorageBin printDto : printList) {
|
||||
String storageBin = printDto.getStorageBin();
|
||||
String handle = StorageBin.genHandle(site, storageBin);
|
||||
StorageBin byId = this.getById(handle);
|
||||
if (byId == null) {
|
||||
throw BusinessException.build("存储货格" + storageBin + "不存在");
|
||||
}
|
||||
Map<String, Object> dataMap = new HashMap();
|
||||
dataMap.put("storageNo", storageBin);
|
||||
dataMap.put("description", byId.getDescription());
|
||||
mapList.add(dataMap);
|
||||
}
|
||||
// printResult= printService.doPrintForHorizon2(site, user, "", printList.get(0).getStorageBin(), 1, "", Constant.PRINT_SCENARIO_STORAGE_LOCATION, mapList, printNumber);
|
||||
|
||||
return "暂无打印";
|
||||
}
|
||||
return "暂无打印";
|
||||
}
|
||||
|
||||
@Override
|
||||
public StorageBin getByStorageLocation(String site, String storageLocation) {
|
||||
String storageLocationBo = StorageLocation.genHandle(site, storageLocation);
|
||||
LambdaQueryWrapper<StorageBin> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(StorageBin::getStorageLocationBo, storageLocationBo);
|
||||
queryWrapper.eq(StorageBin::getIsDefault, "Y");
|
||||
queryWrapper.eq(StorageBin::getStatus, StorageBin.STATUS_Y);
|
||||
List<StorageBin> list = this.list(queryWrapper);
|
||||
if (!list.isEmpty()) {
|
||||
return list.get(0);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@Override
|
||||
public StorageBin getByStorageLocation(String site, String storageLocation) {
|
||||
String storageLocationBo = StorageLocation.genHandle(site, storageLocation);
|
||||
LambdaQueryWrapper<StorageBin> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(StorageBin::getStorageLocationBo, storageLocationBo);
|
||||
queryWrapper.eq(StorageBin::getIsDefault, "Y");
|
||||
queryWrapper.eq(StorageBin::getStatus, StorageBin.STATUS_Y);
|
||||
List<StorageBin> list = this.list(queryWrapper);
|
||||
if (!list.isEmpty()) {
|
||||
return list.get(0);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
//新增和更新时个别字段的验证
|
||||
private StorageBinDto validate(StorageBinDto storageBinDto, String site) {
|
||||
//判断是否选择存储货格类型
|
||||
if (StrUtil.isBlank(storageBinDto.getStorageBinType())) {
|
||||
throw BusinessException.build("存储货格类型不能为空");
|
||||
} else {
|
||||
String s = StorageBinType.genHandle(site, storageBinDto.getStorageBinType());
|
||||
StorageBinType byId = storageBinTypeService.getById(s);
|
||||
if (byId == null) {
|
||||
throw BusinessException.build("不存在此存储货格类型");
|
||||
}
|
||||
storageBinDto.setStorageBinTypeBo(byId.getHandle());
|
||||
}
|
||||
//新增和更新时个别字段的验证
|
||||
private StorageBinDto validate(StorageBinDto storageBinDto, String site) {
|
||||
//判断是否选择存储货格类型
|
||||
if (StrUtil.isBlank(storageBinDto.getStorageBinType())) {
|
||||
throw BusinessException.build("存储货格类型不能为空");
|
||||
} else {
|
||||
String s = StorageBinType.genHandle(site, storageBinDto.getStorageBinType());
|
||||
StorageBinType byId = storageBinTypeService.getById(s);
|
||||
if (byId == null) {
|
||||
throw BusinessException.build("不存在此存储货格类型");
|
||||
}
|
||||
storageBinDto.setStorageBinTypeBo(byId.getHandle());
|
||||
}
|
||||
|
||||
//判断是否为默认存储货格
|
||||
if ("Y".equals(storageBinDto.getIsDefault())) {
|
||||
//判断选择的存储货格类型下是否已拥有默认货格
|
||||
LambdaQueryWrapper<StorageBin> queryWrapper = new LambdaQueryWrapper<StorageBin>().eq(StorageBin::getStorageLocationBo, storageBinDto.getStorageLocationBo())
|
||||
.eq(StorageBin::getIsDefault, "Y").eq(StorageBin::getSite, site);
|
||||
StorageBin one = this.getOne(queryWrapper, false);
|
||||
if (one != null && !one.getHandle().equals(storageBinDto.getHandle())) {
|
||||
throw BusinessException.build("当前存储位置下已有默认存储货格");
|
||||
}
|
||||
}
|
||||
return storageBinDto;
|
||||
}
|
||||
//判断是否为默认存储货格
|
||||
if ("Y".equals(storageBinDto.getIsDefault())) {
|
||||
//判断选择的存储货格类型下是否已拥有默认货格
|
||||
LambdaQueryWrapper<StorageBin> queryWrapper = new LambdaQueryWrapper<StorageBin>().eq(StorageBin::getStorageLocationBo, storageBinDto.getStorageLocationBo())
|
||||
.eq(StorageBin::getIsDefault, "Y").eq(StorageBin::getSite, site);
|
||||
StorageBin one = this.getOne(queryWrapper, false);
|
||||
if (one != null && !one.getHandle().equals(storageBinDto.getHandle())) {
|
||||
throw BusinessException.build("当前存储位置下已有默认存储货格");
|
||||
}
|
||||
}
|
||||
return storageBinDto;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStorageLocationByStorageBin(String site, String storageBin) {
|
||||
StorageBin byId = this.getById(StorageBin.genHandle(site, storageBin));
|
||||
if (byId != null) {
|
||||
return baseMapper.getStorageBinWarehouse(byId.getHandle());
|
||||
} else {
|
||||
throw BusinessException.build("存储货格" + storageBin + "不存在");
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public String getStorageLocationByStorageBin(String site, String storageBin) {
|
||||
StorageBin byId = this.getById(StorageBin.genHandle(site, storageBin));
|
||||
if (byId != null) {
|
||||
return baseMapper.getStorageBinWarehouse(byId.getHandle());
|
||||
} else {
|
||||
throw BusinessException.build("存储货格" + storageBin + "不存在");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public StorageBinDto getByCode(String site, String storageBin) {
|
||||
StorageBinDto storageBinDto = new StorageBinDto();
|
||||
StorageBin byId = this.getById(StorageBin.genHandle(site, storageBin));
|
||||
if (byId == null) {
|
||||
throw BusinessException.build("存储货格" + storageBin + "不存在");
|
||||
} else if (StorageBin.STATUS_N.equals(byId.getStatus())) {
|
||||
throw BusinessException.build("存储货格" + storageBin + "已停用");
|
||||
}
|
||||
BeanUtils.copyProperties(byId, storageBinDto);
|
||||
StorageBinType storageBinType = storageBinTypeService.getById(byId.getStorageBinTypeBo());
|
||||
StorageLocation storageLocation = storageLocationService.getById(byId.getStorageLocationBo());
|
||||
storageBinDto.setStorageLocation(storageLocation.getStorageLocation());
|
||||
storageBinDto.setErpStorageLocation(storageLocation.getErpStorageLocation());
|
||||
storageBinDto.setStorageBinQty(storageBinType.getStorageBinQty());
|
||||
storageBinDto.setMixItem(storageBinType.getMixItem());
|
||||
return storageBinDto;
|
||||
}
|
||||
@Override
|
||||
public StorageBinDto getByCode(String site, String storageBin) {
|
||||
StorageBinDto storageBinDto = new StorageBinDto();
|
||||
StorageBin byId = this.getById(StorageBin.genHandle(site, storageBin));
|
||||
if (byId == null) {
|
||||
throw BusinessException.build("存储货格" + storageBin + "不存在");
|
||||
} else if (StorageBin.STATUS_N.equals(byId.getStatus())) {
|
||||
throw BusinessException.build("存储货格" + storageBin + "已停用");
|
||||
}
|
||||
BeanUtils.copyProperties(byId, storageBinDto);
|
||||
StorageBinType storageBinType = storageBinTypeService.getById(byId.getStorageBinTypeBo());
|
||||
StorageLocation storageLocation = storageLocationService.getById(byId.getStorageLocationBo());
|
||||
storageBinDto.setStorageLocation(storageLocation.getStorageLocation());
|
||||
storageBinDto.setErpStorageLocation(storageLocation.getErpStorageLocation());
|
||||
storageBinDto.setStorageBinQty(storageBinType.getStorageBinQty());
|
||||
storageBinDto.setMixItem(storageBinType.getMixItem());
|
||||
return storageBinDto;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bind(String site, String user, String storageBin, List<String> inventoryIdList) {
|
||||
String storageBinBo = StorageBin.genHandle(site, storageBin);
|
||||
String erpStorageLocation = Optional.ofNullable(getStorageLocationByStorageBin(site, storageBin)).orElseThrow(() -> BusinessException.build("未找到货格对应的仓库"));
|
||||
List<String> inventoryBoList = inventoryIdList.stream().map(o -> Inventory.genHandle(site, o)).collect(Collectors.toList());
|
||||
List<Inventory> inventoryList = inventoryService.listByIds(inventoryBoList);
|
||||
inventoryList.stream().filter(o -> !erpStorageLocation.equals(o.getErpStorageLocation())).findFirst().ifPresent(inventory -> {
|
||||
throw BusinessException.build("条码" + inventory.getInventoryId() + "库存地点与货格不匹配");
|
||||
});
|
||||
if (CollectionUtil.isEmpty(inventoryList) || inventoryList.size() != inventoryIdList.size()) {
|
||||
inventoryIdList.removeAll(inventoryList.stream().map(Inventory::getInventoryId).collect(Collectors.toList()));
|
||||
throw BusinessException.build("库存[" + String.join(",", inventoryIdList) + "]不存在");
|
||||
}
|
||||
inventoryService.lambdaUpdate().in(Inventory::getHandle, inventoryBoList)
|
||||
.set(Inventory::getWmsStorageBinBo, storageBinBo)
|
||||
.set(Inventory::getUpdateTime, LocalDateTime.now())
|
||||
.set(Inventory::getUpdater, user).update();
|
||||
inventoryLogService.saveBatch(inventoryList.stream().map(inventory -> inventoryLogService.buildLog(user, inventory.getInventoryId(), null, null, Constant.CHANGE_TYPE_UP_SHELF, inventory.getWmsStorageBinBo(), inventory.getQtyOnHand(), storageBinBo, null, null, null)).collect(Collectors.toList()));
|
||||
@Override
|
||||
public void bind(String site, String user, String storageBin, List<String> inventoryIdList) {
|
||||
String storageBinBo = StorageBin.genHandle(site, storageBin);
|
||||
String erpStorageLocation = Optional.ofNullable(getStorageLocationByStorageBin(site, storageBin)).orElseThrow(() -> BusinessException.build("未找到货格对应的仓库"));
|
||||
List<String> inventoryBoList = inventoryIdList.stream().map(o -> Inventory.genHandle(site, o)).collect(Collectors.toList());
|
||||
List<Inventory> inventoryList = inventoryService.listByIds(inventoryBoList);
|
||||
inventoryList.stream().filter(o -> !erpStorageLocation.equals(o.getErpStorageLocation())).findFirst().ifPresent(inventory -> {
|
||||
throw BusinessException.build("条码" + inventory.getInventoryId() + "库存地点与货格不匹配");
|
||||
});
|
||||
if (CollectionUtil.isEmpty(inventoryList) || inventoryList.size() != inventoryIdList.size()) {
|
||||
inventoryIdList.removeAll(inventoryList.stream().map(Inventory::getInventoryId).collect(Collectors.toList()));
|
||||
throw BusinessException.build("库存[" + String.join(",", inventoryIdList) + "]不存在");
|
||||
}
|
||||
inventoryService.lambdaUpdate().in(Inventory::getHandle, inventoryBoList)
|
||||
.set(Inventory::getWmsStorageBinBo, storageBinBo)
|
||||
.set(Inventory::getUpdateTime, LocalDateTime.now())
|
||||
.set(Inventory::getUpdater, user).update();
|
||||
inventoryLogService.saveBatch(inventoryList.stream().map(inventory -> inventoryLogService.buildLog(user, inventory.getInventoryId(), null, null, Constant.CHANGE_TYPE_UP_SHELF, inventory.getWmsStorageBinBo(), inventory.getQtyOnHand(), storageBinBo, null, null, null)).collect(Collectors.toList()));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unBind(String site, String user, List<String> inventoryIdList) {
|
||||
List<String> inventoryBoList = inventoryIdList.stream().map(o -> Inventory.genHandle(site, o)).collect(Collectors.toList());
|
||||
List<Inventory> inventoryList = inventoryService.listByIds(inventoryBoList);
|
||||
if (CollectionUtil.isEmpty(inventoryList) || inventoryList.size() != inventoryIdList.size()) {
|
||||
inventoryIdList.removeAll(inventoryList.stream().map(Inventory::getInventoryId).collect(Collectors.toList()));
|
||||
throw BusinessException.build("库存[" + String.join(",", inventoryIdList) + "]不存在");
|
||||
}
|
||||
inventoryService.lambdaUpdate().in(Inventory::getHandle, inventoryBoList)
|
||||
.set(Inventory::getWmsStorageBinBo, null)
|
||||
.set(Inventory::getUpdateTime, LocalDateTime.now())
|
||||
.set(Inventory::getUpdater, user).update();
|
||||
inventoryLogService.saveBatch(inventoryList.stream().map(inventory -> inventoryLogService.buildLog(user, inventory.getInventoryId(), null, null, Constant.CHANGE_TYPE_UP_SHELF, inventory.getWmsStorageBinBo(), inventory.getQtyOnHand(), null, null, null, null)).collect(Collectors.toList()));
|
||||
}
|
||||
@Override
|
||||
public void unBind(String site, String user, List<String> inventoryIdList) {
|
||||
List<String> inventoryBoList = inventoryIdList.stream().map(o -> Inventory.genHandle(site, o)).collect(Collectors.toList());
|
||||
List<Inventory> inventoryList = inventoryService.listByIds(inventoryBoList);
|
||||
if (CollectionUtil.isEmpty(inventoryList) || inventoryList.size() != inventoryIdList.size()) {
|
||||
inventoryIdList.removeAll(inventoryList.stream().map(Inventory::getInventoryId).collect(Collectors.toList()));
|
||||
throw BusinessException.build("库存[" + String.join(",", inventoryIdList) + "]不存在");
|
||||
}
|
||||
inventoryService.lambdaUpdate().in(Inventory::getHandle, inventoryBoList)
|
||||
.set(Inventory::getWmsStorageBinBo, null)
|
||||
.set(Inventory::getUpdateTime, LocalDateTime.now())
|
||||
.set(Inventory::getUpdater, user).update();
|
||||
inventoryLogService.saveBatch(inventoryList.stream().map(inventory -> inventoryLogService.buildLog(user, inventory.getInventoryId(), null, null, Constant.CHANGE_TYPE_DOWN_SHELF, inventory.getWmsStorageBinBo(), inventory.getQtyOnHand(), null, null, null, null)).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ScanCodeDTO> scanCode(String site, String user, String code) {
|
||||
pickingService.checkCodePicking(site, code);
|
||||
List<ScanCodeDTO> scanCodeDTOS = inventoryService.selectTrayInvByCode(site, user, code);
|
||||
if (CollectionUtil.isEmpty(scanCodeDTOS)) {
|
||||
throw BusinessException.build("条码" + code + "无法识别");
|
||||
} else {
|
||||
return scanCodeDTOS;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public List<ScanCodeDTO> scanCode(String site, String user, String code) {
|
||||
pickingService.checkCodePicking(site, code);
|
||||
List<ScanCodeDTO> scanCodeDTOS = inventoryService.selectTrayInvByCode(site, user, code);
|
||||
if (CollectionUtil.isEmpty(scanCodeDTOS)) {
|
||||
throw BusinessException.build("条码" + code + "无法识别");
|
||||
} else {
|
||||
return scanCodeDTOS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,6 @@ package com.foreverwin.mom.wms.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.exceptions.MybatisPlusException;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
@ -10,6 +9,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.foreverwin.iep.common.base.FrontPage;
|
||||
import com.foreverwin.iep.common.utils.HandleBoProcessor;
|
||||
import com.foreverwin.iep.prd.domain.GenerateNextNumberRequest;
|
||||
import com.foreverwin.iep.prd.domain.GenerateNextNumberResponse;
|
||||
import com.foreverwin.iep.prd.entity.Item;
|
||||
@ -19,12 +19,10 @@ import com.foreverwin.mom.common.core.exception.BusinessException;
|
||||
import com.foreverwin.mom.common.data.tenant.TenantContextHolder;
|
||||
import com.foreverwin.mom.common.security.util.SecurityUtils;
|
||||
import com.foreverwin.mom.wms.constant.Constant;
|
||||
import com.foreverwin.mom.wms.constant.KeyWordConstant;
|
||||
import com.foreverwin.mom.wms.dto.InventoryDto;
|
||||
import com.foreverwin.mom.wms.dto.ScanCodeDTO;
|
||||
import com.foreverwin.mom.wms.entity.Carrier;
|
||||
import com.foreverwin.mom.wms.entity.Inventory;
|
||||
import com.foreverwin.mom.wms.entity.InventoryGroup;
|
||||
import com.foreverwin.mom.wms.entity.InventoryLog;
|
||||
import com.foreverwin.mom.wms.mapper.ZWmsInventoryMapper;
|
||||
import com.foreverwin.mom.wms.service.*;
|
||||
@ -276,6 +274,7 @@ public class ZWmsInventoryServiceImpl extends ServiceImpl<ZWmsInventoryMapper, I
|
||||
return splitInventory(site, user, parentInventoryId, splitQty, splitNum, documentNo, documentType, storageBinBo, null);
|
||||
}
|
||||
|
||||
//@GlobalTransactional
|
||||
@Override
|
||||
public List<String> splitInventory(String site, String user, String parentInventoryId, BigDecimal splitQty, int splitNum, String documentNo, String documentType, String storageBinBo, List<String> newInventoryIdList) {
|
||||
Inventory parentInventory = getByCode(site, parentInventoryId);
|
||||
@ -288,64 +287,67 @@ public class ZWmsInventoryServiceImpl extends ServiceImpl<ZWmsInventoryMapper, I
|
||||
lambdaQueryWrapper.eq(StorageBinBindInventory::getStatus, "Y");
|
||||
List<StorageBinBindInventory> bindInventoryList = storageBinBindInventoryService.list(lambdaQueryWrapper);*/
|
||||
String parentStorageBinBo = parentInventory.getWmsStorageBinBo();
|
||||
if (StrUtil.isBlank(parentStorageBinBo)) {
|
||||
throw BusinessException.build("条码" + parentInventory.getInventoryId() + "未绑定货格");
|
||||
/*if (StrUtil.isBlank(parentStorageBinBo)) {
|
||||
throw BusinessException.build("条码" + parentInventory.getInventoryId() + "未绑定货格");
|
||||
} else {*/
|
||||
//校验数量
|
||||
BigDecimal qty = splitQty.multiply(BigDecimal.valueOf(splitNum));
|
||||
if (parentInventory.getQtyOnHand().compareTo(qty) < 0) {
|
||||
throw BusinessException.build("库存" + parentInventoryId + "数量" + parentInventory.getQtyOnHand().stripTrailingZeros().toPlainString() + "不满足拆批数量" + qty.stripTrailingZeros().toPlainString());
|
||||
} else {
|
||||
//校验数量
|
||||
BigDecimal qty = splitQty.multiply(BigDecimal.valueOf(splitNum));
|
||||
if (parentInventory.getQtyOnHand().compareTo(qty) < 0) {
|
||||
throw BusinessException.build("库存" + parentInventoryId + "数量" + parentInventory.getQtyOnHand().stripTrailingZeros().toPlainString() + "不满足拆批数量" + qty.stripTrailingZeros().toPlainString());
|
||||
} else {
|
||||
//生成新条码
|
||||
if (CollectionUtil.isEmpty(newInventoryIdList)) {
|
||||
newInventoryIdList = generatorDocumentNo("RAW_MATERIAL_ID", null, splitNum);
|
||||
}
|
||||
//创建库存
|
||||
List<Inventory> newInventoryList = new ArrayList<>();
|
||||
for (String inventoryId : newInventoryIdList) {
|
||||
Inventory inventory = new Inventory();
|
||||
BeanUtils.copyProperties(parentInventory, inventory);
|
||||
inventory.setHandle(Inventory.genHandle(site, inventoryId));
|
||||
inventory.setInventoryId(inventoryId);
|
||||
inventory.setCreator(user);
|
||||
inventory.setQtyOnHand(splitQty);
|
||||
inventory.setOriginalQty(splitQty);
|
||||
inventory.setIsLot(null);
|
||||
//inventory.setCreateTime(LocalDateTime.now());
|
||||
inventory.setParentInventoryBo(parentInventory.getHandle());
|
||||
newInventoryList.add(inventory);
|
||||
}
|
||||
saveBatch(newInventoryList);
|
||||
//货格绑定/库存日志
|
||||
storageBinBo = StrUtil.blankToDefault(storageBinBo, parentStorageBinBo);
|
||||
|
||||
for (String inventoryId : newInventoryIdList) {
|
||||
lambdaUpdate().eq(Inventory::getHandle, Inventory.genHandle(site, inventoryId))
|
||||
.set(Inventory::getWmsStorageBinBo, storageBinBo)
|
||||
.set(Inventory::getUpdateTime, LocalDateTime.now())
|
||||
.set(Inventory::getUpdater, user).update();
|
||||
|
||||
inventoryLogService.saveLog(user, inventoryId, documentNo, null, StrUtil.isBlank(documentType) ? Constant.CHANGE_TYPE_SPLIT : documentType,
|
||||
null, null, storageBinBo);
|
||||
}
|
||||
//更新父库存
|
||||
BigDecimal subtract = parentInventory.getQtyOnHand().subtract(qty);
|
||||
updateQty(user, parentInventoryId, subtract);
|
||||
//数量为0解绑父库存
|
||||
boolean parentIsEmpty = BigDecimal.ZERO.compareTo(subtract) == 0;
|
||||
if (parentIsEmpty) {
|
||||
lambdaUpdate().eq(Inventory::getHandle, Inventory.genHandle(site, parentInventoryId))
|
||||
.set(Inventory::getWmsStorageBinBo, null)
|
||||
.set(Inventory::getUpdateTime, LocalDateTime.now())
|
||||
.set(Inventory::getUpdater, user).update();
|
||||
}
|
||||
//父库存日志
|
||||
inventoryLogService.saveLog(user, parentInventoryId, documentNo, parentInventory.getStatus(), Constant.CHANGE_TYPE_SPLIT,
|
||||
parentStorageBinBo, parentInventory.getQtyOnHand(), parentIsEmpty ? null : parentStorageBinBo);
|
||||
//返回新库存ID
|
||||
return newInventoryIdList;
|
||||
//生成新条码
|
||||
if (CollectionUtil.isEmpty(newInventoryIdList)) {
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("ITEM", HandleBoProcessor.trimHandle(parentInventory.getItemBo()));
|
||||
map.put("BATCH", parentInventory.getBatchNo());
|
||||
newInventoryIdList = generatorDocumentNo("RAW_MATERIAL_ID", map, splitNum);
|
||||
}
|
||||
//创建库存
|
||||
List<Inventory> newInventoryList = new ArrayList<>();
|
||||
for (String inventoryId : newInventoryIdList) {
|
||||
Inventory inventory = new Inventory();
|
||||
BeanUtils.copyProperties(parentInventory, inventory);
|
||||
inventory.setHandle(Inventory.genHandle(site, inventoryId));
|
||||
inventory.setInventoryId(inventoryId);
|
||||
inventory.setCreator(user);
|
||||
inventory.setQtyOnHand(splitQty);
|
||||
inventory.setOriginalQty(splitQty);
|
||||
|
||||
//inventory.setCreateTime(LocalDateTime.now());
|
||||
inventory.setParentInventoryBo(parentInventory.getHandle());
|
||||
newInventoryList.add(inventory);
|
||||
}
|
||||
saveBatch(newInventoryList);
|
||||
//货格绑定/库存日志
|
||||
storageBinBo = StrUtil.blankToDefault(storageBinBo, parentStorageBinBo);
|
||||
|
||||
for (String inventoryId : newInventoryIdList) {
|
||||
lambdaUpdate().eq(Inventory::getHandle, Inventory.genHandle(site, inventoryId))
|
||||
.set(StrUtil.isNotBlank(storageBinBo), Inventory::getWmsStorageBinBo, storageBinBo)
|
||||
.set(Inventory::getUpdateTime, LocalDateTime.now())
|
||||
.set(Inventory::getUpdater, user).update();
|
||||
|
||||
inventoryLogService.saveLog(user, inventoryId, documentNo, null, StrUtil.isBlank(documentType) ? Constant.CHANGE_TYPE_SPLIT : documentType,
|
||||
null, null, storageBinBo);
|
||||
}
|
||||
//更新父库存
|
||||
BigDecimal subtract = parentInventory.getQtyOnHand().subtract(qty);
|
||||
updateQty(user, parentInventoryId, subtract);
|
||||
//数量为0解绑父库存
|
||||
boolean parentIsEmpty = BigDecimal.ZERO.compareTo(subtract) == 0;
|
||||
if (parentIsEmpty) {
|
||||
lambdaUpdate().eq(Inventory::getHandle, Inventory.genHandle(site, parentInventoryId))
|
||||
.set(Inventory::getWmsStorageBinBo, null)
|
||||
.set(Inventory::getUpdateTime, LocalDateTime.now())
|
||||
.set(Inventory::getUpdater, user).update();
|
||||
}
|
||||
//父库存日志
|
||||
inventoryLogService.saveLog(user, parentInventoryId, documentNo, parentInventory.getStatus(), Constant.CHANGE_TYPE_SPLIT,
|
||||
parentStorageBinBo, parentInventory.getQtyOnHand(), parentIsEmpty ? null : parentStorageBinBo);
|
||||
//返回新库存ID
|
||||
return newInventoryIdList;
|
||||
}
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
@ -363,6 +365,7 @@ public class ZWmsInventoryServiceImpl extends ServiceImpl<ZWmsInventoryMapper, I
|
||||
return nextNumberResponse.getIds();
|
||||
}
|
||||
|
||||
//@GlobalTransactional
|
||||
@Override
|
||||
public String mergeInventory(String site, String user, List<String> inventoryIdList) {
|
||||
List<String> inventoryBoList = inventoryIdList.stream().map(o -> Inventory.genHandle(site, o)).collect(Collectors.toList());
|
||||
@ -377,42 +380,45 @@ public class ZWmsInventoryServiceImpl extends ServiceImpl<ZWmsInventoryMapper, I
|
||||
lambdaQueryWrapper.in(StorageBinBindInventory::getInventoryBo, inventoryBoList);
|
||||
lambdaQueryWrapper.eq(StorageBinBindInventory::getStatus, "Y");
|
||||
List<StorageBinBindInventory> bindInventoryList = storageBinBindInventoryService.list(lambdaQueryWrapper);*/
|
||||
List<Inventory> notBindList = lambdaQuery().in(Inventory::getHandle, inventoryBoList).isNull(Inventory::getWmsStorageBinBo).select(Inventory::getInventoryId).list();
|
||||
if (CollectionUtil.isNotEmpty(notBindList)) {
|
||||
throw BusinessException.build("库存[" + notBindList.stream().map(Inventory::getInventoryId).collect(Collectors.joining(",")) + "]未绑定货格");
|
||||
} else {
|
||||
//扣除父库存数量并解绑
|
||||
BigDecimal qty = BigDecimal.ZERO;
|
||||
/*List<Inventory> notBindList = lambdaQuery().in(Inventory::getHandle, inventoryBoList).isNull(Inventory::getWmsStorageBinBo).select(Inventory::getInventoryId).list();
|
||||
if (CollectionUtil.isNotEmpty(notBindList)) {
|
||||
throw BusinessException.build("库存[" + notBindList.stream().map(Inventory::getInventoryId).collect(Collectors.joining(",")) + "]未绑定货格");
|
||||
} else {*/
|
||||
//扣除父库存数量并解绑
|
||||
BigDecimal qty = BigDecimal.ZERO;
|
||||
|
||||
update(Wrappers.lambdaUpdate(Inventory.class).in(Inventory::getHandle, inventoryBoList)
|
||||
.set(Inventory::getWmsStorageBinBo, null)
|
||||
.set(Inventory::getQtyOnHand, BigDecimal.ZERO)
|
||||
.set(Inventory::getUpdater, user)
|
||||
.set(Inventory::getUpdateTime, LocalDateTime.now()));
|
||||
for (Inventory inventory : inventoryList) {
|
||||
String inventoryId = inventory.getInventoryId();
|
||||
BigDecimal qtyOnHand = inventory.getQtyOnHand();
|
||||
qty = qty.add(qtyOnHand);
|
||||
inventoryLogService.saveLog(user, inventoryId, null, inventory.getStatus(), Constant.CHANGE_TYPE_MERGE,
|
||||
inventory.getWmsStorageBinBo(), qtyOnHand, null);
|
||||
}
|
||||
//创建新库存并绑定
|
||||
String inventoryId = generatorDocumentNo("RAW_MATERIAL_ID", null, 1).get(0);
|
||||
Inventory inventory = new Inventory();
|
||||
BeanUtils.copyProperties(inventoryList.get(0), inventory);
|
||||
inventory.setHandle(Inventory.genHandle(site, inventoryId));
|
||||
inventory.setInventoryId(inventoryId);
|
||||
inventory.setCreator(user);
|
||||
inventory.setQtyOnHand(qty);
|
||||
inventory.setOriginalQty(qty);
|
||||
inventory.setIsLot(null);
|
||||
inventory.setCreateTime(LocalDateTime.now());
|
||||
inventory.setWmsStorageBinBo(inventoryList.get(0).getWmsStorageBinBo());
|
||||
save(inventory);
|
||||
inventoryLogService.saveLog(user, inventoryId, null, null, Constant.CHANGE_TYPE_MERGE,
|
||||
null, null, inventoryList.get(0).getWmsStorageBinBo());
|
||||
return inventoryId;
|
||||
update(Wrappers.lambdaUpdate(Inventory.class).in(Inventory::getHandle, inventoryBoList)
|
||||
.set(Inventory::getWmsStorageBinBo, null)
|
||||
.set(Inventory::getQtyOnHand, BigDecimal.ZERO)
|
||||
.set(Inventory::getUpdater, user)
|
||||
.set(Inventory::getUpdateTime, LocalDateTime.now()));
|
||||
for (Inventory inventory : inventoryList) {
|
||||
String inventoryId = inventory.getInventoryId();
|
||||
BigDecimal qtyOnHand = inventory.getQtyOnHand();
|
||||
qty = qty.add(qtyOnHand);
|
||||
inventoryLogService.saveLog(user, inventoryId, null, inventory.getStatus(), Constant.CHANGE_TYPE_MERGE,
|
||||
inventory.getWmsStorageBinBo(), qtyOnHand, null);
|
||||
}
|
||||
//创建新库存并绑定
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("ITEM", HandleBoProcessor.trimHandle(inventoryList.get(0).getItemBo()));
|
||||
map.put("BATCH", inventoryList.get(0).getBatchNo());
|
||||
String inventoryId = generatorDocumentNo("RAW_MATERIAL_ID", map, 1).get(0);
|
||||
Inventory inventory = new Inventory();
|
||||
BeanUtils.copyProperties(inventoryList.get(0), inventory);
|
||||
inventory.setHandle(Inventory.genHandle(site, inventoryId));
|
||||
inventory.setInventoryId(inventoryId);
|
||||
inventory.setCreator(user);
|
||||
inventory.setQtyOnHand(qty);
|
||||
inventory.setOriginalQty(qty);
|
||||
inventory.setIsLot(null);
|
||||
inventory.setCreateTime(LocalDateTime.now());
|
||||
inventory.setWmsStorageBinBo(inventoryList.get(0).getWmsStorageBinBo());
|
||||
save(inventory);
|
||||
inventoryLogService.saveLog(user, inventoryId, null, null, Constant.CHANGE_TYPE_MERGE,
|
||||
null, null, inventoryList.get(0).getWmsStorageBinBo());
|
||||
return inventoryId;
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
@ -431,18 +437,19 @@ public class ZWmsInventoryServiceImpl extends ServiceImpl<ZWmsInventoryMapper, I
|
||||
@Override
|
||||
public InventoryDto selectForSplit(String site, String inventoryId) {
|
||||
InventoryDto inventoryDto = baseMapper.selectWithStorageBin(Inventory.genHandle(site, inventoryId));
|
||||
String itemType = Optional.ofNullable(inventoryDto).orElseThrow(() -> BusinessException.build("库存不存在或未绑定货格")).getItemType();
|
||||
if (StrUtil.isBlank(itemType) || !StrUtil.equalsAny(itemType, KeyWordConstant.ITEM_MATERIAL_TYPE_ROH, KeyWordConstant.ITEM_MATERIAL_TYPE_VERP)) {
|
||||
throw BusinessException.build("非原材料/包材不允许拆合批");
|
||||
} else if (BigDecimal.ZERO.compareTo(inventoryDto.getQtyOnHand()) == 0) {
|
||||
/*String itemType = Optional.ofNullable(inventoryDto).orElseThrow(() -> BusinessException.build("库存不存在或未绑定货格")).getItemType();
|
||||
if (StrUtil.isBlank(itemType) || !StrUtil.equalsAny(itemType, KeyWordConstant.ITEM_MATERIAL_TYPE_ROH, KeyWordConstant.ITEM_MATERIAL_TYPE_VERP)) {
|
||||
throw BusinessException.build("非原材料/包材不允许拆合批");
|
||||
} else*/
|
||||
if (BigDecimal.ZERO.compareTo(inventoryDto.getQtyOnHand()) == 0) {
|
||||
throw BusinessException.build("库存为0不允许拆合批");
|
||||
} else {
|
||||
long count = inventoryGroupService.count(Wrappers.lambdaQuery(InventoryGroup.class).eq(InventoryGroup::getInventoryBo, Inventory.genHandle(site, inventoryId)));
|
||||
if (count > 0) {
|
||||
throw BusinessException.build("分组库存不允许拆合批");
|
||||
} else {
|
||||
return inventoryDto;
|
||||
}
|
||||
/*long count = inventoryGroupService.count(Wrappers.lambdaQuery(InventoryGroup.class).eq(InventoryGroup::getInventoryBo, Inventory.genHandle(site, inventoryId)));
|
||||
if (count > 0) {
|
||||
throw BusinessException.build("分组库存不允许拆合批");
|
||||
} else {*/
|
||||
return inventoryDto;
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -29,15 +29,16 @@
|
||||
</resultMap>
|
||||
|
||||
<select id="getBindInventoryList" resultMap="dtoResultMap">
|
||||
SELECT WC.`CARRIER`
|
||||
SELECT WI.INVENTORY_ID AS CARRIER_OR_INVENTORY
|
||||
, WC.`CARRIER`
|
||||
, SUBSTRING_INDEX(SUBSTRING_INDEX(WI.ITEM_BO , ',', -2),',', 1) AS ITEM
|
||||
, WI.QTY_ON_HAND
|
||||
, WI.QUALITY_INSPECTION_STATUS
|
||||
, WI.STATUS
|
||||
, WI.BATCH_NO
|
||||
, WI.ERP_STORAGE_LOCATION
|
||||
, WI.WMS_STORAGE_BIN_BO
|
||||
, WI.INVENTORY_ID AS CARRIER_OR_INVENTORY
|
||||
, SUBSTRING_INDEX(SUBSTRING_INDEX(WI.ITEM_BO , ',', -2),',', 1) AS ITEM
|
||||
, SUBSTRING_INDEX(WI.WMS_STORAGE_BIN_BO, ',', -1) AS STORAGE_BIN
|
||||
FROM WMS_CARRIER_MEMBER WCM
|
||||
JOIN WMS_CARRIER WC ON WC.`HANDLE`=WCM.`CARRIER_BO`
|
||||
JOIN WMS_INVENTORY WI ON WI.`HANDLE`=WCM.`CARRIER_OR_INVENTORY_BO`
|
||||
|
||||
@ -218,13 +218,12 @@
|
||||
</select>
|
||||
|
||||
<select id="selectWithStorageBin" resultType="com.foreverwin.mom.wms.dto.InventoryDto">
|
||||
SELECT WI.HANDLE,WI.`INVENTORY_ID`,WI.ORIGINAL_QTY,WI.ITEM_BO, WI.`QTY_ON_HAND`, I.`UNIT_OF_MEASURE` , I.`ITEM`, I.`DESCRIPTION`, WSBBI.STORAGE_BIN_BO
|
||||
, WI.`STATUS`, CF.FIELD_VALUE AS ITEM_TYPE, WI.BATCH_NO, WI.DELAY_TIME, WI.QMS_SPECIAL_MARKING
|
||||
SELECT WI.HANDLE,WI.`INVENTORY_ID`,WI.ORIGINAL_QTY,WI.ITEM_BO, WI.`QTY_ON_HAND`
|
||||
, SUBSTRING_INDEX(SUBSTRING_INDEX(WI.ITEM_BO , ',', -2),',', 1) AS ITEM
|
||||
, wi.WMS_STORAGE_BIN_BO
|
||||
, WI.`STATUS`, WI.BATCH_NO
|
||||
FROM WMS_INVENTORY WI
|
||||
INNER JOIN ITEM I ON I.`HANDLE` = WI.`ITEM_BO`
|
||||
INNER JOIN CUSTOM_FIELDS CF ON CF.HANDLE = I.HANDLE AND CF.FIELD_NAME = 'CUSTOM_ITEM_TYPE'
|
||||
INNER JOIN WMS_STORAGE_BIN_BIND_INVENTORY WSBBI ON WSBBI.INVENTORY_BO = WI.HANDLE AND WSBBI.STATUS = 'Y'
|
||||
WHERE WI.`HANDLE`= #{handle} AND WI.IS_LOT IS NULL
|
||||
WHERE WI.`HANDLE`= #{handle}
|
||||
</select>
|
||||
<select id="selectQtyList" resultType="com.foreverwin.mom.wms.entity.Inventory">
|
||||
SELECT WI.INVENTORY_ID ,WI.QTY_ON_HAND
|
||||
|
||||
Loading…
Reference in New Issue
Block a user