فهرست منبع

新增刪除入库功能;
更新打包版本号为1.1;

xiaosonghong 6 روز پیش
والد
کامیت
342a71875d

+ 1 - 1
pom.xml

@@ -6,7 +6,7 @@
 
     <groupId>org.example</groupId>
     <artifactId>dil-wms-api</artifactId>
-    <version>1.14</version>
+    <version>1.1</version>
 
     <parent>
         <groupId>org.springframework.boot</groupId>

+ 12 - 0
src/main/java/com/steerinfo/dil/controller/OyeResultController.java

@@ -213,6 +213,18 @@ public class OyeResultController extends BaseRESTfulController {
         }
     }
 
+    @ApiOperation("删除手工入库记录")
+    @PostMapping("deleteInResult")
+    public RESTfulResult deleteInResult(@RequestBody Map<String,Object> map) {
+        try {
+            oyeResultService.deleteInResult(map);
+            return success("删除成功!");
+        } catch (Exception e) {
+            e.printStackTrace();
+            return failed(e.getMessage());
+        }
+    }
+
     @ApiOperation("划分实时库存重量")
     @PostMapping("updateInsertRealTimeWeight")
     public RESTfulResult updateInsertRealTimeWeight(@RequestBody Map<String,Object> map) {

+ 1 - 0
src/main/java/com/steerinfo/dil/mapper/OyeInboundResultMapper.java

@@ -31,4 +31,5 @@ public interface OyeInboundResultMapper extends IBaseMapper<OyeInboundResult, Bi
 
     int updateOOOrderStatus(BigDecimal orderId);
 
+    int insertBak(OyeInboundResult inboundResult);
 }

+ 31 - 1
src/main/java/com/steerinfo/dil/service/impl/OyeResultServiceImpl.java

@@ -434,7 +434,37 @@ public class OyeResultServiceImpl implements IOyeResultService {
         oyeOutboundResultMapper.insertSelective(oyeOutboundResult);
         return "操作成功";
     }
-
+    @Transactional(rollbackFor = Exception.class)
+    public synchronized void deleteInResult(Map<String, Object> map) throws RuntimeException{
+        BigDecimal resultId = DataChange.dataToBigDecimal(map.get("resultId"));
+        OyeInboundResult inboundResult = oyeInboundResultMapper.selectByPrimaryKey(resultId);
+        if(inboundResult == null || inboundResult.getResultId() == null){
+            throw new RuntimeException("未找到对应入库记录");
+        }
+        if(!"新厂钢材入库".equals(inboundResult.getCapacityNumbher())){
+            throw new RuntimeException("只允许删除手动入库记录");
+        }
+        //减掉实时库存
+        BigDecimal inventoryId = inboundResult.getInventoryId();
+        BigDecimal materialNumber = inboundResult.getMaterialNumber();
+        BigDecimal theoryWeight = inboundResult.getTheoryWeight();
+        BigDecimal netWeight = inboundResult.getNetWeight();
+        OyeRealtimeInventory oyeRealtimeInventory = oyeRealtimeInventoryMapper.selectByPrimaryKey(inventoryId);
+        BigDecimal realTimeTheoryWeight = oyeRealtimeInventory.getTheoryWeight();
+        BigDecimal realTimeMaterialNumber = oyeRealtimeInventory.getMaterialNumber();
+        BigDecimal realTimeNetWeight = oyeRealtimeInventory.getNetWeight();
+        if (realTimeMaterialNumber.compareTo(materialNumber) < 0 ) {
+            throw new RuntimeException("删除入库的件数大于库存件数,无法删除入库");
+        }
+        oyeRealtimeInventory.setMaterialNumber(realTimeMaterialNumber.subtract(materialNumber));
+        oyeRealtimeInventory.setTheoryWeight(realTimeTheoryWeight.subtract(theoryWeight));
+        oyeRealtimeInventory.setNetWeight(realTimeNetWeight.subtract(netWeight));
+        inboundResult.setUpdateUsername(map.get("deletedUser") == null ? "unknown" : map.get("deletedUser").toString());
+        inboundResult.setUpdateTime(new Date());
+        oyeInboundResultMapper.insertBak(inboundResult);
+        oyeInboundResultMapper.deleteByPrimaryKey(inboundResult.getResultId());
+        oyeRealtimeInventoryMapper.updateByPrimaryKeySelective(oyeRealtimeInventory);
+    }
     /**
      * 划拨实时库存重量
      * @param map

+ 24 - 2
src/main/resources/com/steerinfo/dil/mapper/OyeInboundResultMapper.xml

@@ -854,7 +854,8 @@
            OO.ORDER_NUMBER      "orderNumber",
            OO.CAPACITY_ID       "capacityId",
            ASM.EAS_PRIMARY_ID   "easPrimaryId",
-           TWB.WEIGHT_BATCH_ID  "weightBatchId"
+           TWB.WEIGHT_BATCH_ID  "weightBatchId",
+           OIR.RESULT_ID        "resultId"
            FROM OYE_INBOUND_RESULT OIR
            LEFT JOIN RMS_MATERIAL RM on OIR.MATERIAL_ID = RM.MATERIAL_ID
            LEFT JOIN RMS_CONSIGNEE RC on OIR.CONSIGNEE_ID = RC.CONSIGNEE_ID
@@ -944,5 +945,26 @@
     SET OO.ORDER_STATUS = 2
     WHERE OO.ORDER_ID = #{orderId}
   </update>
-
+  <insert id="insertBak" parameterType="com.steerinfo.dil.model.OyeInboundResult">
+    insert into OYE_INBOUND_RESULT_DELETED_BAK (RESULT_ID, INVENTORY_ID, SALE_NO,
+                                    ORDER_ID, SALE_MATERIAL_ID, CONSIGNEE_ID,
+                                    CAPACITY_NUMBHER, CAPACITY_ID, MATERIAL_ID,
+                                    METER, MATERIAL_NUMBER, THEORY_WEIGHT,
+                                    SINGLE_WEIGHT, SALE_AREA, NET_WEIGHT,
+                                    INBOUND_WAREHOUSE, INBOUND_AREA, INSERT_TIME,
+                                    INSERT_USERNAME, UPDATE_TIME, UPDATE_USERNAME,
+                                    DELETED, ALTERNATE_FIELDS2, ALTERNATE_FIELDS3,
+                                    ALTERNATE_FIELDS4, ALTERNATE_FIELDS5, ALTERNATE_FIELDS6,
+                                    ALTERNATE_FIELDS7, ALTERNATE_FIELDS8)
+    values (#{resultId,jdbcType=DECIMAL}, #{inventoryId,jdbcType=DECIMAL}, #{saleNo,jdbcType=VARCHAR},
+            #{orderId,jdbcType=DECIMAL}, #{saleMaterialId,jdbcType=DECIMAL}, #{consigneeId,jdbcType=DECIMAL},
+            #{capacityNumbher,jdbcType=VARCHAR}, #{capacityId,jdbcType=DECIMAL}, #{materialId,jdbcType=DECIMAL},
+            #{meter,jdbcType=DECIMAL}, #{materialNumber,jdbcType=DECIMAL}, #{theoryWeight,jdbcType=DECIMAL},
+            #{singleWeight,jdbcType=DECIMAL}, #{saleArea,jdbcType=VARCHAR}, #{netWeight,jdbcType=DECIMAL},
+            #{inboundWarehouse,jdbcType=VARCHAR}, #{inboundArea,jdbcType=VARCHAR}, #{insertTime,jdbcType=TIMESTAMP},
+            #{insertUsername,jdbcType=VARCHAR}, #{updateTime,jdbcType=TIMESTAMP}, #{updateUsername,jdbcType=VARCHAR},
+            #{deleted,jdbcType=VARCHAR}, #{alternateFields2,jdbcType=VARCHAR}, #{alternateFields3,jdbcType=VARCHAR},
+            #{alternateFields4,jdbcType=VARCHAR}, #{alternateFields5,jdbcType=VARCHAR}, #{alternateFields6,jdbcType=VARCHAR},
+            #{alternateFields7,jdbcType=VARCHAR}, #{alternateFields8,jdbcType=VARCHAR})
+  </insert>
 </mapper>