diff --git a/src/main/java/com/glxp/api/controller/inout/IoOrderController.java b/src/main/java/com/glxp/api/controller/inout/IoOrderController.java index 8559a64e..7d5596ec 100644 --- a/src/main/java/com/glxp/api/controller/inout/IoOrderController.java +++ b/src/main/java/com/glxp/api/controller/inout/IoOrderController.java @@ -19,6 +19,7 @@ import com.glxp.api.req.auth.FilterInvBusUserRequest; import com.glxp.api.req.basic.BasicEntrustRecRequest; import com.glxp.api.req.inout.*; import com.glxp.api.req.system.DeleteRequest; +import com.glxp.api.req.udims.PostUdimsOrderRequest; import com.glxp.api.res.PageSimpleResponse; import com.glxp.api.res.inout.IoOrderDetailBizResponse; import com.glxp.api.res.inout.IoOrderDetailCodeResponse; @@ -28,6 +29,7 @@ import com.glxp.api.service.auth.InvBusUserService; import com.glxp.api.service.basic.EntrustReceService; import com.glxp.api.service.basic.IBasicBussinessTypeService; import com.glxp.api.service.inout.*; +import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; @@ -46,6 +48,7 @@ import java.util.List; @Slf4j @RestController +@Api("单据相关") public class IoOrderController extends BaseController { @Resource @@ -638,5 +641,15 @@ public class IoOrderController extends BaseController { return ResultVOUtils.success(); } + // --------------------------------------------------------UDI_MS平台-------------------------------------------------------------------------------------- + + @ApiOperation("udims上传单据") + @PostMapping("/warehouse/inout/postOrdersUdims") + public BaseResponse postOrdersUdims(@RequestBody PostUdimsOrderRequest orderRequest) { + + ioAddInoutService.creatOrderByUdims(orderRequest); + + return ResultVOUtils.success(); + } } diff --git a/src/main/java/com/glxp/api/req/udims/PostUdimsOrderDetailRequest.java b/src/main/java/com/glxp/api/req/udims/PostUdimsOrderDetailRequest.java new file mode 100644 index 00000000..01badbde --- /dev/null +++ b/src/main/java/com/glxp/api/req/udims/PostUdimsOrderDetailRequest.java @@ -0,0 +1,36 @@ +package com.glxp.api.req.udims; + +import lombok.Data; + +import java.math.BigDecimal; +import java.time.LocalDate; + +/** + * udims单据上传,单据详情参数 + */ +@Data +public class PostUdimsOrderDetailRequest { + + //uuid + private String uuidFk; + + //批次号 + private String batchNo; + + //价格 + private BigDecimal price; + + //销售发票号(第一票) + private String firstSalesInvNo; + + //销售发票号(第二票) + private String secSalesInvNo; + + //销售清单号(第二票) + private String secSalesListNo; + + //开票日期 + private LocalDate invoiceDate; + + +} diff --git a/src/main/java/com/glxp/api/req/udims/PostUdimsOrderRequest.java b/src/main/java/com/glxp/api/req/udims/PostUdimsOrderRequest.java new file mode 100644 index 00000000..23190b88 --- /dev/null +++ b/src/main/java/com/glxp/api/req/udims/PostUdimsOrderRequest.java @@ -0,0 +1,61 @@ +package com.glxp.api.req.udims; + +import lombok.Data; + +import java.util.List; + +@Data +public class PostUdimsOrderRequest { + + List orderBeans; + private String customerId; + + + @Data + public static class OrderBean { + private String orderId; + private String corpOrderId; + private String action; + private String actDate; + private String actor; + private String mainAction; + private String fromCorpId; + private String fromCorp; + private String remark; + private String invStorageCode; + private String deptCode; + private List orderDetails; + private List codes; + + @Data + public static class CodeBean { + private String action; + private String mainAction; + private String code; + private String corpOrderId; + private String actor; + private String actDate; + private String fromCorpId; + private String fromCorp; + private String orderId; + private String batchNo; + private String produceDate; + private String expireDate; + private String serialNo; + private Integer count; + private String packageLevel; + private String warehouseCode; + + private String customerId; + private String nameCode; + private String supId;//供应商ID + private String invStorageCode; + private String invWarehouseCode; + private String relId; + private Integer status; + private String locStorageCode; + } + } + + +} diff --git a/src/main/java/com/glxp/api/service/inout/IoAddInoutService.java b/src/main/java/com/glxp/api/service/inout/IoAddInoutService.java index d3b114ce..5b680106 100644 --- a/src/main/java/com/glxp/api/service/inout/IoAddInoutService.java +++ b/src/main/java/com/glxp/api/service/inout/IoAddInoutService.java @@ -22,6 +22,7 @@ import com.glxp.api.entity.system.SystemParamConfigEntity; import com.glxp.api.req.basic.FilterCompanyProductRelevanceRequest; import com.glxp.api.entity.inout.PdaCodeEntity; import com.glxp.api.req.inout.PostOrderRequest; +import com.glxp.api.req.udims.PostUdimsOrderRequest; import com.glxp.api.res.basic.UdiRelevanceResponse; import com.glxp.api.service.basic.BasicCorpService; import com.glxp.api.service.basic.IBasicBussinessTypeService; @@ -38,6 +39,7 @@ import com.glxp.api.util.udi.UdiCalCountUtil; import org.springframework.beans.BeanUtils; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.util.ArrayList; @@ -696,4 +698,101 @@ public class IoAddInoutService { } + + //duims上传单据 + @Transactional + public void creatOrderByUdims(PostUdimsOrderRequest postOrderRequest) { + List postOrders = postOrderRequest.getOrderBeans(); + if (postOrders != null && postOrders.size() > 0) { + for (int i = 0; i < postOrders.size(); i++) { + PostUdimsOrderRequest.OrderBean postOrder = postOrders.get(i); + //创建单据 + IoOrderEntity orderEntity = orderService.findByBillNo(postOrder.getOrderId()); + if (orderEntity != null) { + //已包含业务单据校验 +// orderEntity.setUpdateUser(postOrderRequest.getUserId() + ""); + orderEntity.setUpdateTime(new Date()); + orderService.update(orderEntity); + List pdaCodeEntities = postOrder.getCodes(); + if (pdaCodeEntities != null && pdaCodeEntities.size() > 0) { + PostUdimsOrderRequest.OrderBean.CodeBean pdaCodeEntity = pdaCodeEntities.get(0); + //写入条码 + List ioCodeEnttities = new ArrayList<>(); + for (int index = 0; index < pdaCodeEntities.size(); index++) { + IoCodeTempEntity codeEnttity = new IoCodeTempEntity(); + BeanUtils.copyProperties(pdaCodeEntities.get(index), codeEnttity); + codeEnttity.setAction(orderEntity.getAction()); + codeEnttity.setMainAction(orderEntity.getMainAction()); + codeEnttity.setDeptCode(orderEntity.getDeptCode()); + codeEnttity.setOrderId(orderEntity.getBillNo()); + codeEnttity.setInvCode(orderEntity.getInvCode()); + codeEnttity.setReCount(codeEnttity.getCount() * udiCalCountUtil.getActCount(codeEnttity.getNameCode())); + codeEnttity.setUpdateTime(new Date()); + codeEnttity.setCreateTime(DateUtil.parseDate(pdaCodeEntity.getActDate())); + ioCodeEnttities.add(codeEnttity); + } + codeTempService.insertBatch(ioCodeEnttities); + dealProcess(orderEntity); + if (!ioCheckInoutService.checkManual(orderEntity.getBillNo())) { + ioCheckInoutService.check(orderEntity.getBillNo()); + } + } + } else { + //创建新单据 + BasicBussinessTypeEntity bussinessTypeEntity = basicBussinessTypeService.findByAction(postOrder.getAction()); + String orderNo = gennerOrderUtils.createScOrderNo(new OrderNoTypeBean(Constant.SCAN_ORDER + StrUtil.trimToEmpty(bussinessTypeEntity.getPrefix()), "yyyyMMdd")); + IoOrderEntity orderSaveRequest = new IoOrderEntity(); + orderSaveRequest.setBillNo(orderNo); + orderSaveRequest.setMainAction(postOrder.getMainAction()); + orderSaveRequest.setAction(postOrder.getAction()); + orderSaveRequest.setCorpOrderId(postOrder.getCorpOrderId()); + orderSaveRequest.setFromCorp(postOrder.getFromCorp()); + orderSaveRequest.setCustomerId(postOrderRequest.getCustomerId()); + orderSaveRequest.setDeptCode(postOrder.getDeptCode()); + orderSaveRequest.setInvCode(postOrder.getInvStorageCode()); + orderSaveRequest.setStatus(ConstantStatus.ORDER_STATUS_PROCESS); + orderSaveRequest.setDealStatus(ConstantStatus.ORDER_DEAL_POST); +// orderSaveRequest.setCreateUser(postOrderRequest.getUserId() + ""); +// orderSaveRequest.setUpdateUser(postOrderRequest.getUserId() + ""); + orderSaveRequest.setUpdateTime(new Date()); + orderSaveRequest.setBusType(bussinessTypeEntity.getBusType()); + orderSaveRequest.setOrderType(ConstantStatus.ORDER_TYPE_SCAN); + orderSaveRequest.setFromType(ConstantStatus.FROM_UDIMS); + List pdaCodeEntities = postOrder.getCodes(); + if (pdaCodeEntities != null && pdaCodeEntities.size() > 0) { + PostUdimsOrderRequest.OrderBean.CodeBean pdaCodeEntity = pdaCodeEntities.get(0); + if (pdaCodeEntity.getActDate() != null) { + orderSaveRequest.setCreateTime(DateUtil.parseDate(pdaCodeEntity.getActDate())); + } + //写入条码 + List ioCodeEnttities = new ArrayList<>(); + for (int index = 0; index < pdaCodeEntities.size(); index++) { + IoCodeTempEntity codeEnttity = new IoCodeTempEntity(); + BeanUtils.copyProperties(pdaCodeEntities.get(index), codeEnttity); + codeEnttity.setAction(orderSaveRequest.getAction()); + codeEnttity.setMainAction(orderSaveRequest.getMainAction()); + codeEnttity.setDeptCode(orderSaveRequest.getDeptCode()); + codeEnttity.setOrderId(orderSaveRequest.getBillNo()); + codeEnttity.setInvCode(orderSaveRequest.getInvCode()); + codeEnttity.setReCount(codeEnttity.getCount() * udiCalCountUtil.getActCount(codeEnttity.getNameCode())); + codeEnttity.setUpdateTime(new Date()); + codeEnttity.setCreateTime(DateUtil.parseDate(pdaCodeEntity.getActDate())); + ioCodeEnttities.add(codeEnttity); + } + codeTempService.insertBatch(ioCodeEnttities); + } + orderService.insertOrder(orderSaveRequest); + dealProcess(orderSaveRequest); + if (!ioCheckInoutService.checkManual(orderEntity.getBillNo())) { + ioCheckInoutService.check(orderEntity.getBillNo()); + } + } + + + } + } + + } + + } diff --git a/src/main/java/com/glxp/api/vo/inv/InvWarehouseTreeVo.java b/src/main/java/com/glxp/api/vo/inv/InvWarehouseTreeVo.java index aa26b3c7..2068c2cd 100644 --- a/src/main/java/com/glxp/api/vo/inv/InvWarehouseTreeVo.java +++ b/src/main/java/com/glxp/api/vo/inv/InvWarehouseTreeVo.java @@ -9,6 +9,9 @@ import java.util.List; @Data public class InvWarehouseTreeVo extends InvWarehouseEntity { + private String deptCode; + + private String deptName; List bussinessTypeList = new ArrayList<>(); diff --git a/src/main/resources/mybatis/mapper/auth/InvWarehouseDao.xml b/src/main/resources/mybatis/mapper/auth/InvWarehouseDao.xml index 24e7335a..9d1e4a52 100644 --- a/src/main/resources/mybatis/mapper/auth/InvWarehouseDao.xml +++ b/src/main/resources/mybatis/mapper/auth/InvWarehouseDao.xml @@ -401,10 +401,11 @@