north-glass-erp/src/main/java/com/example/erp/entity/mm/MaterialLog.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
north-glass-erp/src/main/java/com/example/erp/mapper/mm/MaterialLogMapper.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
north-glass-erp/src/main/java/com/example/erp/service/mm/MaterialInventoryService.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
north-glass-erp/src/main/resources/mapper/mm/MaterialLogMapper.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
north-glass-erp/src/main/resources/mapper/sd/DeliveryDetailMapper.xml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
north-glass-erp/src/main/java/com/example/erp/entity/mm/MaterialLog.java
New file @@ -0,0 +1,34 @@ package com.example.erp.entity.mm; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.example.erp.entity.sd.OrderDetail; import lombok.Data; import java.time.LocalDate; @Data public class MaterialLog { @TableId(type = IdType.AUTO) private Long id; private String operationOrderNumber; private String operateType; private Integer operationNumber; private Long inventoryId; private Long materialCode; private String materialName; private String producer; private String unit; private Double width; private Double height; private Double thickness; private Integer quantity; private Double singlePieceArea; private String inventoryArea; private String remarks; private String operator; private LocalDate operateTime; } north-glass-erp/src/main/java/com/example/erp/mapper/mm/MaterialLogMapper.java
New file @@ -0,0 +1,15 @@ package com.example.erp.mapper.mm; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.example.erp.entity.mm.MaterialLog; import com.example.erp.entity.sd.Order; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import java.util.List; import java.util.Map; @Mapper public interface MaterialLogMapper extends BaseMapper<MaterialLog> { } north-glass-erp/src/main/java/com/example/erp/service/mm/MaterialInventoryService.java
@@ -14,6 +14,7 @@ import com.example.erp.entity.userInfo.SysError; import com.example.erp.mapper.mm.BasicWarehouseTypeMapper; import com.example.erp.mapper.mm.MaterialInventoryMapper; import com.example.erp.mapper.mm.MaterialLogMapper; import com.example.erp.mapper.mm.MaterialStoreMapper; import com.example.erp.service.userInfo.LogService; import com.example.erp.service.userInfo.SysErrorService; @@ -44,6 +45,8 @@ SysErrorService sysErrorService; @Autowired LogService logService; @Autowired MaterialLogMapper materialLogMapper; public String saveMaterialOutbound(Map<String,Object> object) { String saveState = "true"; @@ -111,6 +114,28 @@ //修改物料库存表出库数量 materialInventoryMapper.updateMaterialInventoryAvailableOut(materialOutboundDetail.getId(), materialOutboundDetail.getOutboundQuantity()); }*/ String json=""; MaterialStore materialStore=materialStoreMapper.getSelectMaterialStoreById(Long.valueOf(materialOutboundDetail.getMaterialCode())); json=materialStore.getJson().substring(1, materialStore.getJson().length() - 1); MaterialLog materialLog=new MaterialLog(); materialLog.setOperationOrderNumber(oddNumber); materialLog.setOperationNumber(materialOutboundDetailMaximum + 1); materialLog.setOperateType("物料出库"); materialLog.setMaterialCode(Long.valueOf(materialOutboundDetail.getMaterialCode())); materialLog.setMaterialName(convertString(json,"\"name\"")); materialLog.setProducer(materialInventory.getProducer()); materialLog.setUnit(convertString(json,"\"unit\"")); materialLog.setWidth(convertDouble(json,"\"width\"")); materialLog.setHeight(convertDouble(json,"\"height\"")); materialLog.setThickness(convertDouble(json,"\"thickness\"")); materialLog.setQuantity(materialOutboundDetail.getOutboundQuantity()); materialLog.setSinglePieceArea(materialOutboundDetail.getSinglePieceArea()); materialLog.setInventoryId(materialOutboundDetail.getId()); materialLog.setInventoryArea(materialInventory.getInventoryArea()); materialLog.setRemarks(materialOutboundDetail.getRemarks()); materialLog.setOperator(object.get("userName").toString()); materialLog.setOperateTime(LocalDate.now()); materialLogMapper.insert(materialLog); }else{ TransactionAspectSupport.currentTransactionStatus().rollbackToSavepoint(savePoint); return "false1"; @@ -172,6 +197,27 @@ materialInventoryMapper.insertMaterialInventory(materialCode,singlePieceArea,totalArea,materialInventory); log.setFunction("saveMaterialInventory新增"); } String json=""; MaterialStore materialStore=materialStoreMapper.getSelectMaterialStoreById(materialCode); json=materialStore.getJson().substring(1, materialStore.getJson().length() - 1); MaterialLog materialLog=new MaterialLog(); materialLog.setOperateType("物料新增"); materialLog.setMaterialCode(materialCode); materialLog.setMaterialName(convertString(json,"\"name\"")); materialLog.setProducer(materialInventory.getProducer()); materialLog.setUnit(convertString(json,"\"unit\"")); materialLog.setWidth(convertDouble(json,"\"width\"")); materialLog.setHeight(convertDouble(json,"\"height\"")); materialLog.setThickness(convertDouble(json,"\"thickness\"")); materialLog.setQuantity(materialInventory.getInventoryQuantity()); materialLog.setSinglePieceArea(singlePieceArea); materialLog.setInventoryId(materialInventory.getId()); materialLog.setInventoryArea(materialInventory.getInventoryArea()); materialLog.setRemarks(materialInventory.getRemarks()); materialLog.setOperator(object.get("userName").toString()); materialLog.setOperateTime(LocalDate.now()); materialLogMapper.insert(materialLog); logService.saveLog(log); } catch (Exception e) { TransactionAspectSupport.currentTransactionStatus().rollbackToSavepoint(savePoint); @@ -456,8 +502,8 @@ json=materialStore.getJson().substring(1, materialStore.getJson().length() - 1); double width= convert(json,"\"width\""); double height=convert(json,"\"height\""); double width= convertDouble(json,"\"width\""); double height= convertDouble(json,"\"height\""); DecimalFormat decimalFormat = new DecimalFormat("#0.00"); singlePieceArea= Double.parseDouble(decimalFormat.format(width * height / 100000)); totalArea= Double.parseDouble(decimalFormat.format(singlePieceArea * returningWarehouseDetail.getReturnQuantity())); @@ -493,6 +539,25 @@ materialInventoryMapper.updateReturningWarehouseDetail(oddNumber, returningWarehouseDetailMaximum + 1,MaterialInventoryId.get(0).getId()); MaterialLog materialLog=new MaterialLog(); materialLog.setOperationOrderNumber(oddNumber); materialLog.setOperationNumber(returningWarehouseDetailMaximum + 1); materialLog.setOperateType("物料返库"); materialLog.setMaterialCode(returningWarehouseDetail.getId()); materialLog.setMaterialName(convertString(json,"\"name\"")); materialLog.setProducer(returningWarehouseDetail.getProducer()); materialLog.setUnit(convertString(json,"\"unit\"")); materialLog.setWidth(convertDouble(json,"\"width\"")); materialLog.setHeight(convertDouble(json,"\"height\"")); materialLog.setThickness(convertDouble(json,"\"thickness\"")); materialLog.setQuantity(returningWarehouseDetail.getReturnQuantity()); materialLog.setSinglePieceArea(singlePieceArea); materialLog.setInventoryArea(returningWarehouseDetail.getInventoryArea()); materialLog.setRemarks(returningWarehouseDetail.getRemarks()); materialLog.setOperator(object.get("userName").toString()); materialLog.setOperateTime(LocalDate.now()); materialLogMapper.insert(materialLog); } @@ -719,7 +784,7 @@ } public double convert(String json,String string) { public String convertString(String json,String string) { Map<String, Object> map = new HashMap<>(); String[] keyValues = json.split(","); for (String keyValue : keyValues) { @@ -728,7 +793,19 @@ map.put(pair[0], pair[1]); } } double number=0.0; return map.get(string).toString().replace("\"",""); } public Double convertDouble(String json,String string) { Map<String, Object> map = new HashMap<>(); String[] keyValues = json.split(","); for (String keyValue : keyValues) { String[] pair = keyValue.split(":"); if (pair.length == 2) { map.put(pair[0], pair[1]); } } Double number=0.0; if(map.get(string)!=null){ String[] widthStrings = map.get(string).toString().split("\\D+"); for (String numberString : widthStrings) { north-glass-erp/src/main/resources/mapper/mm/MaterialLogMapper.xml
New file @@ -0,0 +1,7 @@ <?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="com.example.erp.mapper.mm.MaterialLogMapper"> </mapper> north-glass-erp/src/main/resources/mapper/sd/DeliveryDetailMapper.xml
@@ -792,12 +792,6 @@ <if test="deliveryDetail.deliveryNumber != null and deliveryDetail.deliveryNumber != ''"> and dd.delivery_number like concat('%',#{deliveryDetail.deliveryNumber},'%') </if> <if test="deliveryDetail.orderDetail!=null and deliveryDetail.orderDetail.productId != null and deliveryDetail.orderDetail.productId != ''"> and od.product_id like concat('%',#{deliveryDetail.orderDetail.productId},'%') </if> <if test="deliveryDetail.orderDetail!=null and deliveryDetail.orderDetail.productName != null and deliveryDetail.orderDetail.productName != ''"> and od.product_name like concat('%', #{deliveryDetail.orderDetail.productName},'%') </if> <if test="deliveryDetail.orderId != null and deliveryDetail.orderId != ''"> and dd.order_id like concat('%', #{deliveryDetail.orderId},'%') </if> @@ -859,10 +853,10 @@ and d.delivery_address like concat('%', #{deliveryDetail.delivery.deliveryAddress},'%') </if> <if test="deliveryDetail.orderDetail!=null and (deliveryDetail.orderDetail.productName != null and deliveryDetail.orderDetail.productName != '')"> and od.product_id like concat('%', #{deliveryDetail.orderDetail.productName},'%') and od.product_name like concat('%', #{deliveryDetail.orderDetail.productName},'%') </if> <if test="deliveryDetail.orderDetail!=null and (deliveryDetail.orderDetail.productId != null and deliveryDetail.orderDetail.productId != '')"> and od.product_name like concat('%', #{deliveryDetail.orderDetail.productId},'%') and od.product_id like concat('%', #{deliveryDetail.orderDetail.productId},'%') </if> <if test="deliveryDetail.order!=null and (deliveryDetail.order.otherMoney != null )"> and o.other_money regexp REGEXP_REPLACE(#{deliveryDetail.order.otherMoney},'\\.0+$','') @@ -900,12 +894,6 @@ <if test="deliveryDetail.deliveryNumber != null and deliveryDetail.deliveryNumber != ''"> and dd.delivery_number like concat('%',#{deliveryDetail.deliveryNumber},'%') </if> <if test="deliveryDetail.orderDetail!=null and deliveryDetail.orderDetail.productId != null and deliveryDetail.orderDetail.productId != ''"> and od.product_id like concat('%',#{deliveryDetail.orderDetail.productId},'%') </if> <if test="deliveryDetail.orderDetail!=null and deliveryDetail.orderDetail.productName != null and deliveryDetail.orderDetail.productName != ''"> and od.product_name like concat('%', #{deliveryDetail.orderDetail.productName},'%') </if> <if test="deliveryDetail.orderId != null and deliveryDetail.orderId != ''"> and dd.order_id like concat('%', #{deliveryDetail.orderId},'%') </if> @@ -967,10 +955,10 @@ and d.delivery_address like concat('%', #{deliveryDetail.delivery.deliveryAddress},'%') </if> <if test="deliveryDetail.orderDetail!=null and (deliveryDetail.orderDetail.productName != null and deliveryDetail.orderDetail.productName != '')"> and od.product_id like concat('%', #{deliveryDetail.orderDetail.productName},'%') and od.product_name like concat('%', #{deliveryDetail.orderDetail.productName},'%') </if> <if test="deliveryDetail.orderDetail!=null and (deliveryDetail.orderDetail.productId != null and deliveryDetail.orderDetail.productId != '')"> and od.product_name like concat('%', #{deliveryDetail.orderDetail.productId},'%') and od.product_id like concat('%', #{deliveryDetail.orderDetail.productId},'%') </if> <if test="deliveryDetail.order!=null and (deliveryDetail.order.otherMoney != null )"> and o.other_money regexp REGEXP_REPLACE(#{deliveryDetail.order.otherMoney},'\\.0+$','')