feat(wip):委外库存物料提交
This commit is contained in:
parent
808e31f544
commit
050ddeef5b
@ -4,6 +4,7 @@ import com.foreverwin.iep.smd.dto.ResrceDTO;
|
||||
import com.foreverwin.mom.common.core.constant.SecurityConstants;
|
||||
import com.foreverwin.mom.common.core.util.R;
|
||||
|
||||
import com.foreverwin.mom.wms.entity.Inventory;
|
||||
import com.foreverwin.mom.wms.entity.InventoryRecord;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@ -29,6 +30,9 @@ public interface RemoteWmsInventoryRecordService {
|
||||
@PutMapping("/wms-inventoryRecord/api/updateById")
|
||||
R<Boolean> apiUpdateById(@RequestBody InventoryRecord inventoryRecord);
|
||||
|
||||
@GetMapping("/wms-inventoryRecord/api/selectBySyncStatus")
|
||||
R<List<InventoryRecord>> selectBySyncStatus();
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -95,4 +95,7 @@ public interface RemoteWmsInventoryService {
|
||||
@GetMapping("/wms-inventory/api/{site}/{item}")
|
||||
R<Item> selectCurrentByMes(@PathVariable("site") String site, @PathVariable("item") String item);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -34,5 +34,5 @@ public class MaterialConsumptionImportantDTO {
|
||||
|
||||
|
||||
@ExcelProperty(value = "工作中心", index = 7)
|
||||
public String getWorkCenter;
|
||||
public String WorkCenter;
|
||||
}
|
||||
|
||||
@ -45,4 +45,10 @@ public class DataImportController {
|
||||
exportTemplateService.exportX(importType);
|
||||
}
|
||||
|
||||
@GetMapping("/export-inventoryRecords-template")
|
||||
@ResponseBody
|
||||
public void exportInventoryRecordTemplate(String importType) throws IOException {
|
||||
exportTemplateService.exportY(importType);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -74,6 +74,12 @@ public class InventoryRecordController {
|
||||
return R.ok(inventoryRecordService.selectBySyncStatusAndType(type));
|
||||
}
|
||||
|
||||
@ApiOperation(value = "通过状态类型查询", notes = "通过状态类型查询")
|
||||
@GetMapping("/api/selectBySyncStatus")
|
||||
public R<List<InventoryRecord>> selectBySyncStatus() {
|
||||
return R.ok(inventoryRecordService.selectBySyncStatus());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ApiOperation(value = "修改库存(物料批次)", notes = "修改库存(物料批次)")
|
||||
|
||||
@ -5,4 +5,6 @@ import java.io.IOException;
|
||||
public interface ExportTemplateService {
|
||||
|
||||
void exportX(String importType) throws IOException;
|
||||
|
||||
void exportY(String importType) throws IOException;
|
||||
}
|
||||
|
||||
@ -17,5 +17,13 @@ public interface InventoryRecordService extends IService<InventoryRecord> {
|
||||
|
||||
List<InventoryRecord> selectBySyncStatusAndType(String type);
|
||||
|
||||
|
||||
List<InventoryRecord> selectBySyncStatus();
|
||||
|
||||
|
||||
|
||||
boolean updateById(InventoryRecord inventoryRecord);
|
||||
|
||||
InventoryRecord getByitemDescAndWorkshopNumber(String itemDesc, String workshopNumber,String mainQty,String site);
|
||||
|
||||
}
|
||||
|
||||
@ -599,7 +599,7 @@ public class DataImportServiceImpl implements DataImportService {
|
||||
lastGeneratedTime = now;
|
||||
|
||||
// 定义日期时间格式
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMddHHmmss");
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyMMddHHmmssSSS");
|
||||
// 格式化当前时间为字符串
|
||||
return now.format(formatter);
|
||||
}
|
||||
@ -759,13 +759,14 @@ public class DataImportServiceImpl implements DataImportService {
|
||||
inventoryRecord.setGrade("A");
|
||||
inventoryRecord.setSyncStatus("N");
|
||||
|
||||
// R<List<OperationOutBomComponentDTO>> bySiteAndShopOrder = remoteWipService.getBySiteAndShopOrder("2021", "1000000004", "1000026");
|
||||
// R<List<···0------------------------------------------------------------------------------------------------------------->> bySiteAndShopOrder = remoteWipService.getBySiteAndShopOrder("2021", "1000000004", "1000026");
|
||||
// List<OperationOutBomComponentDTO> operationOutBomComponentDTO = bySiteAndShopOrder.getData();
|
||||
OperationOutBomComponentDTO operationOutBomComponentDTO = inventoryRecordMapper.selectOperationOutBomComponent( site, data.getShopOrder(), data.getWorkshopNumber());
|
||||
if (operationOutBomComponentDTO != null) {
|
||||
inventoryRecord.setReservedNo(operationOutBomComponentDTO.getReserved());
|
||||
inventoryRecord.setReservedLine(operationOutBomComponentDTO.getReservedSeq());
|
||||
}else {
|
||||
}
|
||||
else {
|
||||
errorMessage.append(MessageFormat.format("第{0}行;查找不到相对应的预留编号与预留行号 \n", row, data.getShopOrder()));
|
||||
}
|
||||
|
||||
@ -806,17 +807,11 @@ public class DataImportServiceImpl implements DataImportService {
|
||||
// if (StrUtil.isBlank(data.getBarcode())) {
|
||||
// errorMessage.append(MessageFormat.format("第{0}行;条码不能为空 \n", row));
|
||||
// } else {
|
||||
// inventory = inventoryRecordService.getByCode(site, data.getBarcode());
|
||||
// if (inventory != null) {
|
||||
// isUpdate = true;
|
||||
// }
|
||||
// Integer row_ = uniqueMap.get(data.getBarcode());
|
||||
// if (row_ == null || row_ < 0) {
|
||||
// uniqueMap.put(data.getBarcode(), row);
|
||||
// } else {
|
||||
// errorMessage.append(MessageFormat.format("第{0}行与{1}行库存条码{2}重复 \n", row, row_, data.getBarcode()));
|
||||
// }
|
||||
// }
|
||||
inventory = inventoryRecordService.getByitemDescAndWorkshopNumber(data.getSupplier(), data.getWorkshopNumber(), data.getMainQty(), site);
|
||||
if (inventory != null) {
|
||||
isUpdate = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -938,7 +933,7 @@ public class DataImportServiceImpl implements DataImportService {
|
||||
inventoryRecord.setMainUom(data.getMainUom());
|
||||
inventoryRecord.setErpInventory(data.getErpInventory());
|
||||
inventoryRecord.setSyncPostingDate(LocalDate.now());
|
||||
inventoryRecord.setWorkCenter(data.getWorkCenter);
|
||||
inventoryRecord.setWorkCenter(data.getWorkCenter());
|
||||
|
||||
//TODO: 2023/3/21 获取物料的物料组
|
||||
// R<List<OperationOutBomComponentDTO>> bySiteAndShopOrder = remoteWipService.getBySiteAndShopOrder(site, data.getShopOrder(), data.getWorkCenter);
|
||||
@ -953,9 +948,10 @@ public class DataImportServiceImpl implements DataImportService {
|
||||
if (operationOutBomComponentDTO != null) {
|
||||
inventoryRecord.setReservedNo(operationOutBomComponentDTO.getReserved());
|
||||
inventoryRecord.setReservedLine(operationOutBomComponentDTO.getReservedSeq());
|
||||
}else {
|
||||
errorMessage.append(MessageFormat.format("第{0}行;查找不到相对应的预留编号与预留行号 \n", row, data.getShopOrder()));
|
||||
}
|
||||
// else {
|
||||
// errorMessage.append(MessageFormat.format("第{0}行;查找不到相对应的预留编号与预留行号 \n", row, data.getShopOrder()));
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
@ -3,10 +3,7 @@ package com.foreverwin.mom.wms.service.impl;
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.foreverwin.mom.common.core.exception.BusinessException;
|
||||
import com.foreverwin.mom.common.data.tenant.TenantContextHolder;
|
||||
import com.foreverwin.mom.wms.dto.CarrierImportDto;
|
||||
import com.foreverwin.mom.wms.dto.InventoryImportDTO;
|
||||
import com.foreverwin.mom.wms.dto.StorageBinImportDto;
|
||||
import com.foreverwin.mom.wms.dto.StorageLocationIODto;
|
||||
import com.foreverwin.mom.wms.dto.*;
|
||||
import com.foreverwin.mom.wms.service.ExportTemplateService;
|
||||
import com.foreverwin.mom.wms.util.EasyExcelCellWriteHandler;
|
||||
import lombok.AllArgsConstructor;
|
||||
@ -51,6 +48,27 @@ public class ExportTemplateServiceImpl implements ExportTemplateService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exportY(String importType) throws IOException {
|
||||
ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
|
||||
HttpServletResponse response = attributes.getResponse();
|
||||
response.setCharacterEncoding("utf-8");
|
||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + System.currentTimeMillis() + ".xlsx");
|
||||
switch (importType) {
|
||||
case "1":
|
||||
//库存
|
||||
this.exportInventoryRecordTemplate(response);
|
||||
break;
|
||||
case "2":
|
||||
//存储位置
|
||||
this.exportMaterialConsumptionImportantDTOTemplate(response);
|
||||
break;
|
||||
default:
|
||||
throw BusinessException.build("不支持的模板类型");
|
||||
}
|
||||
}
|
||||
|
||||
private void exportInventoryTemplate(HttpServletResponse response) throws IOException {
|
||||
|
||||
List<InventoryImportDTO> list = new ArrayList<>();
|
||||
@ -141,4 +159,49 @@ public class ExportTemplateServiceImpl implements ExportTemplateService {
|
||||
}
|
||||
*/
|
||||
|
||||
private void exportInventoryRecordTemplate(HttpServletResponse response) throws IOException {
|
||||
|
||||
List<InventoryRecordImportantDTO> list = new ArrayList<>();
|
||||
InventoryRecordImportantDTO importRecordImportantDTO = new InventoryRecordImportantDTO();
|
||||
importRecordImportantDTO.setDateOfManufacture("2024-11-27");
|
||||
importRecordImportantDTO.setErpInventory("1001");
|
||||
importRecordImportantDTO.setBarcode("1234565432");
|
||||
importRecordImportantDTO.setSupplier("1001");
|
||||
importRecordImportantDTO.setStatus("1001");
|
||||
importRecordImportantDTO.setWorkshopNumber("1001");
|
||||
importRecordImportantDTO.setShopOrder("1001");
|
||||
importRecordImportantDTO.setWorkCenter("1001");
|
||||
importRecordImportantDTO.setQtyDone("1000");
|
||||
importRecordImportantDTO.setMainQty("1000");
|
||||
importRecordImportantDTO.setSubQty("1000");
|
||||
importRecordImportantDTO.setSubUom("KG");
|
||||
importRecordImportantDTO.setMainUon("M");
|
||||
importRecordImportantDTO.setUom("F");
|
||||
|
||||
|
||||
list.add(importRecordImportantDTO);
|
||||
List<Integer> columns = Arrays.asList(0, 1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12, 13);
|
||||
EasyExcel.write(response.getOutputStream(), InventoryRecordImportantDTO.class).registerWriteHandler(new EasyExcelCellWriteHandler(columns, true)).autoCloseStream(Boolean.FALSE).sheet("").doWrite(list);
|
||||
|
||||
}
|
||||
|
||||
private void exportMaterialConsumptionImportantDTOTemplate(HttpServletResponse response) throws IOException {
|
||||
List<MaterialConsumptionImportantDTO> list = new ArrayList<>();
|
||||
|
||||
MaterialConsumptionImportantDTO materialConsumptionImportantDTO = new MaterialConsumptionImportantDTO();
|
||||
|
||||
materialConsumptionImportantDTO.setDateOfManufacture("2024-11-27");
|
||||
materialConsumptionImportantDTO.setShopOrder("1001");
|
||||
materialConsumptionImportantDTO.setSupplier("1001");
|
||||
materialConsumptionImportantDTO.setWorkshopNumber("1001");
|
||||
materialConsumptionImportantDTO.setErpInventory("1001");
|
||||
materialConsumptionImportantDTO.setMainQty("1000");
|
||||
materialConsumptionImportantDTO.setMainUom("M");
|
||||
materialConsumptionImportantDTO.setWorkCenter("1001");
|
||||
list.add(materialConsumptionImportantDTO);
|
||||
|
||||
List<Integer> columns = Arrays.asList(0, 2, 3, 4, 5);
|
||||
EasyExcel.write(response.getOutputStream(), MaterialConsumptionImportantDTO.class).registerWriteHandler(new EasyExcelCellWriteHandler(columns, true)).autoCloseStream(Boolean.FALSE).sheet("导出").doWrite(list);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -12,6 +12,7 @@ import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@ -32,9 +33,9 @@ public class InventoryRecordServiceImpl extends ServiceImpl<InventoryRecordMappe
|
||||
}
|
||||
|
||||
@Override
|
||||
public InventoryRecord getByCode(String site, String code) {
|
||||
public InventoryRecord getByCode(String site, String barcode) {
|
||||
|
||||
InventoryRecord inventoryRecord = getById(InventoryRecord.genHandle(site, code));
|
||||
InventoryRecord inventoryRecord = inventoryRecordMapper.getBySiteAndBarcode(site,barcode );
|
||||
return inventoryRecord;
|
||||
}
|
||||
|
||||
@ -43,11 +44,21 @@ public class InventoryRecordServiceImpl extends ServiceImpl<InventoryRecordMappe
|
||||
return inventoryRecordMapper.selectBySyncStatusAndType(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<InventoryRecord> selectBySyncStatus() {
|
||||
return inventoryRecordMapper.selectBySyncStatus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateById(InventoryRecord inventoryRecord) {
|
||||
int i = inventoryRecordMapper.updateById(inventoryRecord);
|
||||
return i > 0 ;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InventoryRecord getByitemDescAndWorkshopNumber(String itemDesc, String workshopNumber, String mainQty, String site) {
|
||||
return inventoryRecordMapper.getByitemDescAndWorkshopNumber(itemDesc, workshopNumber, mainQty, site);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -44,7 +44,12 @@ public interface InventoryRecordMapper extends BaseMapper<InventoryRecord> {
|
||||
@Select("select * from wip.z_external_lot_record WHERE SHOP_ORDER = '2000000013' AND SITE = '2031'")
|
||||
List<ZExternalLotRecord> selectBySyncStatusDTO(String type);
|
||||
|
||||
@Select("SELECT * FROM inventory_records WHERE type = '0' ")
|
||||
List<InventoryRecord> selectBySyncStatus();
|
||||
|
||||
@Select("SELECT * FROM inventory_records WHERE site = #{site} and barcode = #{barcode}")
|
||||
InventoryRecord getBySiteAndBarcode(@Param("site") String site, @Param("barcode") String barcode);
|
||||
|
||||
|
||||
@Select("SELECT * FROM inventory_records WHERE item_desc = #{itemDesc} and workshop_number = #{workshopNumber} and main_qty = #{mainQty} and site = #{site}")
|
||||
InventoryRecord getByitemDescAndWorkshopNumber(@Param("itemDesc") String itemDesc, @Param("workshopNumber") String workshopNumber, @Param("mainQty") String mainQty, @Param("site") String site);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user