1.添加网页端垛码建单功能

2.修改码表,单据详情,库存详情插入数据为批量保存,提高程序性能
master
x_z 3 years ago
parent 4219f8c4f6
commit 7c57bba0d8

@ -44,10 +44,7 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.*;
@Slf4j
@RestController
@ -159,6 +156,18 @@ public class OrderController {
return ResultVOUtils.error(ResultEnum.PARAM_VERIFY_FALL);
}
//兼容前端多个传参方式 todo 后续统一前端删除单据传参方式
if (CollUtil.isEmpty(deleteRequest.getIds())) {
List<String> ids = new ArrayList<>();
if (StrUtil.isNotBlank(deleteRequest.getOrderId())) {
ids.add(deleteRequest.getOrderId());
}
if (StrUtil.isNotBlank(deleteRequest.getId())) {
ids.add(deleteRequest.getId());
}
deleteRequest.setIds(ids);
}
if (CollUtil.isNotEmpty(deleteRequest.getIds())) {
//全部删除
orderService.deleteOrders(deleteRequest.getIds());

@ -25,6 +25,7 @@ import com.glxp.udi.admin.service.auth.CustomerService;
import com.glxp.udi.admin.service.basic.BussinessTypeService;
import com.glxp.udi.admin.service.inout.*;
import com.glxp.udi.admin.service.param.SystemParamCustomerConfigService;
import com.glxp.udi.admin.service.product.StackOrderService;
import com.glxp.udi.admin.thread.TransInoutService;
import com.glxp.udi.admin.util.*;
import org.apache.commons.lang3.StringUtils;
@ -65,6 +66,8 @@ public class WareHouseController {
private GennerOrderUtils gennerOrderUtils;
@Resource
private CustomerService customerService;
@Resource
private StackOrderService stackOrderService;
@AuthRuleAnnotation("")
@PostMapping("warehouse/inout/postOrders")
@ -320,6 +323,57 @@ public class WareHouseController {
}
}
if (code.contains("DH")) {
//扫描的是垛号,直接添加到临时码表,校验等操作后置到处理单据的流程中做
String orderId = addOrderRequest.getOrderId();
//先生成扫码单据
OrderEntity orderEntity = orderService.findById(orderId);
if (StringUtils.isBlank(orderId) || orderEntity == null) {
String orderNo = gennerOrderUtils.createScOrderNo(new OrderNoTypeBean(Constant.SCAN_ORDER + StrUtil.trim(bussinessType.getPrefix()), "yyyyMMdd"));
orderId = orderNo;
OrderEntity orderSaveRequest = new OrderEntity();
orderSaveRequest.setOrderId(orderId);
if (addOrderRequest.getActDate() != null) {
orderSaveRequest.setActDate(addOrderRequest.getActDate());
}
long customerId = customerService.getCustomerId();
orderSaveRequest.setMainAction(bussinessType.getMainAction());
orderSaveRequest.setAction(bussinessType.getAction());
orderSaveRequest.setActor(addOrderRequest.getActor());
orderSaveRequest.setCorpOrderId(addOrderRequest.getCorpOrderId());
orderSaveRequest.setLocStorageCode(addOrderRequest.getLocStorageCode());
orderSaveRequest.setFromCorpId(addOrderRequest.getFromCorpId());
orderSaveRequest.setFromCorp(addOrderRequest.getFromCorp());
orderSaveRequest.setFromType("网页新增");
orderSaveRequest.setStatus(ConstantStatus.ORDER_STATUS_TEMP_SAVE);
orderSaveRequest.setExportStatus("未上传");
orderSaveRequest.setReceiveStatus(ConstantStatus.RECEIVE_UN);
orderSaveRequest.setCustomerId(customerId);
orderService.insertOrder(orderSaveRequest);
}
//将垛号插入临时码表
WarehousetempEntity warehousetemp = new WarehousetempEntity();
warehousetemp.setOrderId(orderId);
warehousetemp.setCode(code);
warehousetemp.setLocStorageCode(addOrderRequest.getLocStorageCode());
warehousetemp.setActor(addOrderRequest.getActor());
warehousetemp.setFromCorp(addOrderRequest.getFromCorp());
warehousetemp.setFromCorpId(addOrderRequest.getFromCorpId());
warehousetemp.setMainAction(bussinessType.getMainAction());
warehousetemp.setAction(bussinessType.getAction());
warehousetemp.setCorpOrderId(addOrderRequest.getCorpOrderId());
warehousetemp.setCustomerId(Long.valueOf(addOrderRequest.getCustomerId()));
warehouseTempService.insertTempWarehouses(Arrays.asList(warehousetemp));
addCodeResult.setOrderId(orderId);
return ResultVOUtils.success(addCodeResult);
}
UdiEntity udiEntity = FilterUdiUtils.getUdi(code);
if (udiEntity == null) {
return ResultVOUtils.error(500, "无效条码!");
@ -422,7 +476,6 @@ public class WareHouseController {
warehousetempEntity.setFromCorp(addOrderRequest.getFromCorp());
warehousetempEntity.setBatchNo(udiEntity.getBatchNo());
warehousetempEntity.setProduceDate(udiEntity.getProduceDate());
warehousetempEntity.setLocStorageCode(addOrderRequest.getInvWarehouseCode());
warehousetempEntity.setNameCode(udiEntity.getNameCode());
warehousetempEntity.setExpireDate(udiEntity.getExpireDate());
warehousetempEntity.setSerialNo(udiEntity.getSerialNo());

@ -59,4 +59,11 @@ public interface CodesDao extends BaseMapper<WarehouseEntity> {
* @param orderId
*/
void updateActDateByOrderId(@Param("actDate") String actDate, @Param("orderId") String orderId);
/**
*
*
* @param list
*/
void batchInsert(List<WarehouseEntity> list);
}

@ -27,4 +27,11 @@ public interface InvProductDetailDao extends BaseMapper<InvProductDetailEntity>
* @param orderId
*/
void deleteByOrderId(@Param("orderId") String orderId);
/**
*
*
* @param list
*/
void batchInsert(List<InvProductDetailEntity> list);
}

@ -5,6 +5,8 @@ import com.glxp.udi.admin.entity.inout.OrderDetailEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
*
*/
@ -25,4 +27,11 @@ public interface OrderDetailDao extends BaseMapper<OrderDetailEntity> {
*/
void update(OrderDetailEntity orderDetailEntity);
/**
*
*
* @param list
*/
void batchInsert(List<OrderDetailEntity> list);
}

@ -3,6 +3,7 @@ package com.glxp.udi.admin.entity.inout;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
@ -17,19 +18,25 @@ public class OrderEntity {
@TableId
private String orderId;
@TableField(value = "action")
private String action;
@TableField(value = "corpOrderId")
private String corpOrderId;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private String actDate;
@TableField(value = "fromCorpId")
private String fromCorpId;
@TableField(value = "actor")
private String actor;
@TableField(value = "mainAction")
private String mainAction;
@TableField(value = "fromCorp")
private String fromCorp;
/**
@ -40,15 +47,19 @@ public class OrderEntity {
* 3.
* 9.
*/
@TableField(value = "status")
private Integer status;
@TableField(value = "remark")
private String remark;
/**
*
*/
@TableField(value = "exportStatus")
private String exportStatus;
@TableField(value = "fromType")
private String fromType;
/**
@ -56,24 +67,32 @@ public class OrderEntity {
*
* 01
*/
@TableField(value = "uploadStatus")
private String uploadStatus;
@TableField(value = "customerId")
private Long customerId;
@TableField(value = "locStorageCode")
private String locStorageCode;
//复制单号,多个单号之间使用英文逗号,分隔
@TableField(value = "replicateNo")
private String replicateNo;
//补单单号
@TableField(value = "supplementNo")
private String supplementNo;
//验收状态0未验收1.已验收2.不需要验收
@TableField(value = "receiveStatus")
private Integer receiveStatus;
@TableField(value = "reviewUser")
private Integer reviewUser;
//单据更新时间
@TableField(value = "updateTime")
private Date updateTime;
public void setActDate(String actDate) {

@ -1,6 +1,7 @@
package com.glxp.udi.admin.service.inout;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
@ -113,4 +114,17 @@ public class InvProductDetailService {
return null;
}
/**
*
*
* @param invProductDetailEntities
*/
public void insertInvProductDetail(List<InvProductDetailEntity> invProductDetailEntities) {
if (CollUtil.isNotEmpty(invProductDetailEntities)) {
List<List<InvProductDetailEntity>> invDetailList = ListUtil.split(invProductDetailEntities, 1000);
for (List<InvProductDetailEntity> list : invDetailList) {
invProductDetailDao.batchInsert(list);
}
}
}
}

@ -1,6 +1,7 @@
package com.glxp.udi.admin.service.inout;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
@ -30,8 +31,10 @@ public class OrderDetailService {
public void insertOrderDetail(List<OrderDetailEntity> orderDetailEntities) {
if (CollUtil.isNotEmpty(orderDetailEntities)) {
for (OrderDetailEntity orderDetailEntity : orderDetailEntities) {
orderDetailDao.insert(orderDetailEntity);
//批量插入数据,提高速度
List<List<OrderDetailEntity>> detailList = ListUtil.split(orderDetailEntities, 1000);
for (List<OrderDetailEntity> list : detailList) {
orderDetailDao.batchInsert(list);
}
}
}

@ -1,6 +1,7 @@
package com.glxp.udi.admin.service.inout;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
@ -71,8 +72,10 @@ public class WarehouseService {
public void insertWarehouses(List<WarehouseEntity> warehouseEntities) {
if (CollUtil.isNotEmpty(warehouseEntities)) {
for (WarehouseEntity warehouseEntity : warehouseEntities) {
codesDao.insert(warehouseEntity);
//对条码进行拆分,使用批量插入,提高插入数据速度
List<List<WarehouseEntity>> codePageList = ListUtil.split(warehouseEntities, 1000);
for (List<WarehouseEntity> list : codePageList) {
codesDao.batchInsert(list);
}
}
}

@ -16,6 +16,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@ -131,6 +132,7 @@ public class InvProductsTrService {
warehouseQueryRequest.setBatchNo(invProductEntity.getBatchNo());
List<WarehouseEntity> warehouseEntities = codesService.filterWarehouse(warehouseQueryRequest);
if (CollUtil.isNotEmpty(warehouseEntities)) {
List<InvProductDetailEntity> invProductDetailEntities = new ArrayList<>(warehouseEntities.size());
for (WarehouseEntity warehouseEntity : warehouseEntities) {
UdiInfoEntity tempUdi = udiInfoService.findByNameCode(warehouseEntity.getNameCode(), customerId);
InvProductDetailEntity invProductDetailEntity = new InvProductDetailEntity();
@ -148,8 +150,9 @@ public class InvProductsTrService {
invProductDetailEntity.setUpdateTime(new Date());
invProductDetailEntity.setCustomerId(customerId);
invProductDetailEntity.setLocStorageCode(warehouseEntity.getLocStorageCode());
invProductDetailService.insertInvProduct(invProductDetailEntity);
invProductDetailEntities.add(invProductDetailEntity);
}
invProductDetailService.insertInvProductDetail(invProductDetailEntities);
}
}

@ -37,4 +37,19 @@
set actDate = #{actDate}
where orderId = #{orderId}
</update>
<insert id="batchInsert">
insert io_codes (code, orderId, corpOrderId, action, mainAction, nameCode, batchNo, serialNo, produceDate,
expireDate, fromCorp, fromCorpId, customerId, packageLevel, supId, supName, relId, count,
locStorageCode, actor, actDate)
values
<foreach collection="list" separator="," index="index" item="item">
(#{item.code}, #{item.orderId}, #{item.corpOrderId}, #{item.action}, #{item.mainAction}, #{item.nameCode},
#{item.batchNo},
#{item.serialNo}, #{item.produceDate}, #{item.expireDate}, #{item.fromCorp}, #{item.fromCorpId},
#{item.customerId},
#{item.packageLevel}, #{item.supId}, #{item.supName}, #{item.relId}, #{item.count}, #{item.locStorageCode},
#{item.actor}, #{item.actDate})
</foreach>
</insert>
</mapper>

@ -13,4 +13,16 @@
from io_inv_product_detail
where orderIdFk = #{orderId}
</delete>
<insert id="batchInsert">
insert into io_inv_product_detail (code, productIdFk, orderIdFk, customerId, mainAction, action, count,
updateTime, batchNo, productDate, expireDate, invProductIdFk,
locStorageCode) VALUES
<foreach collection="list" item="item" index="index" separator=",">
(#{item.code}, #{item.productIdFk}, #{item.orderIdFk}, #{item.customerId}, #{item.mainAction},
#{item.action}, #{item.count},
#{item.updateTime}, #{item.batchNo}, #{item.productDate}, #{item.expireDate}, #{item.invProductIdFk},
#{item.locStorageCode})
</foreach>
</insert>
</mapper>

@ -31,4 +31,18 @@
invoiceDate = #{invoiceDate}
where id = #{id}
</update>
<insert id="batchInsert">
insert into io_order_detail (orderIdFk, relId, uuidFk, nameCode, batchNo, productName, productCompany,
produceDate, expireDate, zczbhhzbapzbh, ggxh, packRatio, reCount, count, price,
firstSalesInvNo, secSalesInvNo, secSalesListNo, invoiceDate)
VALUES
<foreach collection="list" item="item" index="index" separator=",">
(#{item.orderIdFk}, #{item.relId}, #{item.uuidFk}, #{item.nameCode}, #{item.batchNo}, #{item.productName},
#{item.productCompany}, #{item.produceDate}, #{item.expireDate}, #{item.zczbhhzbapzbh}, #{item.ggxh},
#{item.packRatio},
#{item.reCount}, #{item.count}, #{item.price}, #{item.firstSalesInvNo}, #{item.secSalesInvNo},
#{item.secSalesListNo}, #{item.invoiceDate})
</foreach>
</insert>
</mapper>
Loading…
Cancel
Save