Tiroble há 3 anos atrás
pai
commit
31a22c69fe

+ 2 - 0
src/main/java/com/steerinfo/dil/controller/WmsInboundResultController.java

@@ -359,6 +359,8 @@ public class WmsInboundResultController extends BaseRESTfulController {
                         houseGrid = new BigDecimal("12335");
                     }else if (wmspInboundDistribute.getPersonnelWorkshopid().compareTo(new BigDecimal(2))==0){
                         houseGrid = new BigDecimal("24472");
+                    }else {
+                        return null;
                     }
 
                             //创建一个入库作业实绩

+ 8 - 6
src/main/java/com/steerinfo/dil/controller/WmspOutboundResultController.java

@@ -20,6 +20,7 @@ import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Isolation;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.*;
 
@@ -180,7 +181,7 @@ public class WmspOutboundResultController extends BaseRESTfulController {
      * 返回值:
      *   list:出库单实绩
      * */
-    @Transactional
+    @Transactional(isolation = Isolation.READ_COMMITTED)
     @PostMapping(value = "/insertwmspOutboundScanResult")
     public synchronized RESTfulResult insertwmspOutboundScanResult(@RequestBody(required = false) Map<String, Object> map) throws ParseException {
         //判断物资是否满足要求,目前以下三种不做处理的判断
@@ -189,7 +190,7 @@ public class WmspOutboundResultController extends BaseRESTfulController {
         //获取出库单号
         BigDecimal resultId = new BigDecimal(map.get("resultId").toString());
         //物资唯一编码
-        String MaterialOnlyCode=subResultMaterial.split("-")[7];
+        String materialOnlyCode=subResultMaterial.split("-")[7];
 
 
         //判断物质是否已经被扫描
@@ -206,24 +207,25 @@ public class WmspOutboundResultController extends BaseRESTfulController {
         }
         //判断物资是否是需要出库的物资类型,需要出库物资数量不等于0,通过物资唯一编码和出库实绩
         //判断物资是否是需要出库的物资,需要出库物资数量不等于0,通过物资唯一编码和出库实绩
-        Map<String,Object> materialMap = wmspOutboundResultMaterialService.isOutboundResultMaterial(MaterialOnlyCode,resultId);
+        Map<String,Object> materialMap = wmspOutboundResultMaterialService.isOutboundResultMaterial(materialOnlyCode,resultId);
         if (materialMap==null){
             //物质类型错误
             return failed(-4);
         }
         Integer materialNumber= Integer.valueOf(materialMap.get("materailNumber").toString());
         //获得已经扫描的物质数量
-        int scanCount = wmspOutboundScanResultService.getScanCount(MaterialOnlyCode,resultId);
-
-
+        int scanCount = wmspOutboundScanResultService.getScanCount(materialOnlyCode,resultId);
 
         if(list.size()>0&&isScan==0&&(materialNumber!=null&&materialNumber!=0)&&(materialNumber>scanCount)){
+            //替代操作
+            int result = wmspOutboundResultService.replaceSave(materialOnlyCode);
             //创建扫描实绩
             //通过装卸工工号查询装卸工Id
             BigDecimal personnelId = wmspOutboundResultService.getPersonnelIdByJobnumber(map.get("personnelJobNumber").toString());
             //默认以获取到的第一个值作为入库实绩Id
             Map<String, Object> map1 = list.get(0);
             int status= wmspOutboundResultService.createOutboundScanResult(subResultMaterial,personnelId,resultId,(BigDecimal)map1.get("inboundResultId"),new BigDecimal(materialMap.get("resultMaterialId").toString()));
+
             return success(status);
         }else {
 

+ 14 - 0
src/main/java/com/steerinfo/dil/model/WmspInboundResult.java

@@ -64,6 +64,11 @@ public class WmspInboundResult implements IBasePO<BigDecimal> {
     @ApiModelProperty(value="逻辑删除:1:删除;0:未删除",required=false)
     private BigDecimal resultDeleted;
 
+    /**
+     * 逻辑删除:1:删除;0:未删除(RESULT_DELETED,DECIMAL,0)
+     */
+    @ApiModelProperty(value="是否上传金蝶:1:上传了;0:未上传",required=false)
+    private BigDecimal isupload;
     /**
      * 入库日期(INBOUND_TIME,TIMESTAMP,7)
      */
@@ -295,6 +300,14 @@ public class WmspInboundResult implements IBasePO<BigDecimal> {
         return serialVersionUID;
     }
 
+    public BigDecimal getIsupload() {
+        return isupload;
+    }
+
+    public void setIsupload(BigDecimal isupload) {
+        this.isupload = isupload;
+    }
+
     @Override
     public BigDecimal getId() {
         return null;
@@ -304,4 +317,5 @@ public class WmspInboundResult implements IBasePO<BigDecimal> {
     public void setId(BigDecimal bigDecimal) {
 
     }
+
 }

+ 2 - 0
src/main/java/com/steerinfo/dil/service/IWmspOutboundResultService.java

@@ -88,4 +88,6 @@ public interface IWmspOutboundResultService {
     int sureOutbount(BigDecimal resultId) throws Exception;
 
     List<Map<String, Object>> getWmsOutboundResultStatistics(Map<String, Object> mapValue);
+
+    public int replaceSave(String materialOnlyCode);
 }

+ 2 - 0
src/main/java/com/steerinfo/dil/service/impl/WmsInboundResultServiceImpl.java

@@ -168,6 +168,8 @@ public class WmsInboundResultServiceImpl implements IWmsInboundResultService {
         wmspInboundResult.setPersonnelWorkshopid(personnelWorkshopid);
         //入库是否完成(0:未完成,1:已完成)
         wmspInboundResult.setInboundIscomplete(new BigDecimal(complete));
+        //是否上传金蝶
+        wmspInboundResult.setIsupload(new BigDecimal(0));
         //逻辑删除:1:删除;0:未删除
         wmspInboundResult.setResultDeleted(new BigDecimal(0));
         //入库日期

+ 30 - 0
src/main/java/com/steerinfo/dil/service/impl/WmspOutboundResultServiceImpl.java

@@ -419,6 +419,36 @@ public class WmspOutboundResultServiceImpl  implements IWmspOutboundResultServic
         return i;
     }
 
+    public int replaceSave(String materialOnlyCode) {
+        int i=0;
+        Map<String,Object> map  = wmspOutboundScanResultMapper.getMaterialSteelId(materialOnlyCode);
+        if(map == null){
+            return -2;
+        }
+        BigDecimal materialSteelId = DataChange.dataToBigDecimal(map.get("materialId"));
+        Date date = (Date) map.get("updateTime");
+        //如果修改时间为空,就表示该钢材还未出库
+        if(date==null){
+            //判断物资是否是预留物资
+            int isReserve= wmsInboundResultService.getTypeMaterilaId(materialSteelId);
+            //如果是预留物资
+            if (isReserve>0){
+                //将最新的一条真实库数据,状态改为预留状态状态,代替预留库存
+                i+= wmsInboundResultService.updateStatusByMaterialId(materialSteelId);
+                //将预留库出库的钢材,状态改为完全入库状态
+                i+= wmsInboundResultService.updateStatusByMaterilaId(materialSteelId);
+
+            }
+
+        }
+        //表示该钢材已出库,请勿重复扫码
+        else{
+            return -1;
+        }
+
+        return i;
+    }
+
 
     @Override
     @Transactional(rollbackFor = Exception.class)

+ 1 - 1
src/main/resources/com/steerinfo/dil/mapper/WmspCheckWarehouseMapper.xml

@@ -466,7 +466,7 @@
                 GROUP BY RM.MATERIAL_CODE
         ) table1
        ON table1.code = RM.MATERIAL_CODE
-      WHERE RPG.WAREHOUSE_ID = #{warehouseId} AND RM.MATERIAL_NAME IS NOT NULL
+      WHERE RPG.WAREHOUSE_ID = #{warehouseId} AND RM.MATERIAL_NAME IS NOT NULL AND WIR.ISUPLOAD='0'
       <if test="con!=null and con!='null'">
         AND RM.MATERIAL_NAME LIKE (#{con})
         AND table1.count>0

+ 1 - 1
src/main/resources/com/steerinfo/dil/mapper/WmspGridMaterialMapper.xml

@@ -789,7 +789,7 @@
       AND RM.MATERIAL_CODE = #{materialCode}
       AND RM.MATERIAL_MODEL= #{materialModel}
       AND RM.MATERIAL_SPECIFICATION = #{materialSpecification}
-       AND RMS.INSERT_TIME >= trunc(sysdate)
+       AND WIR.INSERT_TIME >= trunc(sysdate)
     ORDER BY RMS.INSERT_TIME DESC
   </select>
     <select id="getGridMaterialAgeList" resultType="java.util.Map">

+ 36 - 10
src/main/resources/com/steerinfo/dil/mapper/WmspInboundResultMapper.xml

@@ -10,6 +10,7 @@
         <result column="INBOUND_GROUP_ID" jdbcType="DECIMAL" property="inboundGroupId" />
         <result column="PERSONNEL_WORKSHOPID" jdbcType="DECIMAL" property="personnelWorkshopid" />
         <result column="RESULT_NUMBER" jdbcType="DECIMAL" property="resultNumber" />
+        <result column="ISUPLOAD" jdbcType="DECIMAL" property="isupload" />
         <result column="RESULT_STATUS" jdbcType="DECIMAL" property="resultStatus" />
         <result column="MATERIAL_ID" jdbcType="DECIMAL" property="materialId" />
         <result column="INBOUND_ISCOMPLETE" jdbcType="DECIMAL" property="inboundIscomplete" />
@@ -22,15 +23,17 @@
         <result column="INSERT_UPDATE_REMARK" jdbcType="VARCHAR" property="insertUpdateRemark" />
         <result column="PERSONNEL_TEAM" jdbcType="VARCHAR" property="personnelTeam" />
         <result column="PERSONNEL_SHIFTS" jdbcType="VARCHAR" property="personnelShifts" />
+        
+        
 
     </resultMap>
     <sql id="columns">
-    INBOUND_ID, INBOUND_TYPE, INBOUND_NUMBER,INBOUND_DISTRIBUTE_ID, GRID_ID,INBOUND_GROUP_ID,PERSONNEL_WORKSHOPID,RESULT_NUMBER, RESULT_STATUS, MATERIAL_ID, INBOUND_ISCOMPLETE,
+    INBOUND_ID, INBOUND_TYPE, INBOUND_NUMBER,INBOUND_DISTRIBUTE_ID, GRID_ID,INBOUND_GROUP_ID,PERSONNEL_WORKSHOPID,RESULT_NUMBER,ISUPLOAD, RESULT_STATUS, MATERIAL_ID, INBOUND_ISCOMPLETE,
     RESULT_DELETED, INBOUND_TIME, INSERT_USERNAME, INSERT_TIME, UPDATE_USERNAME, UPDATE_TIME, 
     INSERT_UPDATE_REMARK, PERSONNEL_TEAM,, PERSONNEL_SHIFTS
   </sql>
     <sql id="columns_alias">
-    t.INBOUND_ID, t.INBOUND_TYPE, t.INBOUND_NUMBER,t.INBOUND_DISTRIBUTE_ID, t.GRID_ID,INBOUND_GROUP_ID,t.PERSONNEL_WORKSHOPID,t.RESULT_NUMBER, t.RESULT_STATUS, t.MATERIAL_ID,
+    t.INBOUND_ID, t.INBOUND_TYPE, t.INBOUND_NUMBER,t.INBOUND_DISTRIBUTE_ID, t.GRID_ID,INBOUND_GROUP_ID,t.PERSONNEL_WORKSHOPID,t.RESULT_NUMBER,ISUPLOAD, t.RESULT_STATUS, t.MATERIAL_ID,
     t.INBOUND_ISCOMPLETE, t.RESULT_DELETED, t.INBOUND_TIME, t.INSERT_USERNAME, t.INSERT_TIME, 
     t.UPDATE_USERNAME, t.UPDATE_TIME, t.INSERT_UPDATE_REMARK, t.PERSONNEL_TEAM, ,
     t.PERSONNEL_SHIFTS
@@ -71,6 +74,9 @@
             <if test="resultNumber != null">
                 and RESULT_NUMBER = #{resultNumber}
             </if>
+            <if test="isupload != null">
+                and ISUPLOAD = #{isupload}
+            </if>
             <if test="resultStatus != null">
                 and RESULT_STATUS = #{resultStatus}
             </if>
@@ -137,6 +143,9 @@
             <if test="resultNumber != null">
                 and RESULT_NUMBER = #{resultNumber}
             </if>
+            <if test="isupload != null">
+                and ISUPLOAD = #{isupload}
+            </if>
             <if test="resultStatus != null">
                 and RESULT_STATUS = #{resultStatus}
             </if>
@@ -207,6 +216,9 @@
         <if test="resultNumber != null">
             or RESULT_NUMBER = #{resultNumber}
         </if>
+        <if test="isupload != null">
+            or ISUPLOAD = #{isupload}
+        </if>
         <if test="resultStatus != null">
             or RESULT_STATUS = #{resultStatus}
         </if>
@@ -246,13 +258,13 @@
     </delete>
     <insert id="insert" parameterType="com.steerinfo.dil.model.WmspInboundResult">
     insert into WMSP_INBOUND_RESULT (INBOUND_ID, INBOUND_TYPE, INBOUND_NUMBER, INBOUND_DISTRIBUTE_ID,
-      GRID_ID,INBOUND_GROUP_ID, PERSONNEL_WORKSHOPID,RESULT_NUMBER,RESULT_STATUS, MATERIAL_ID,
+      GRID_ID,INBOUND_GROUP_ID, PERSONNEL_WORKSHOPID,RESULT_NUMBER,ISUPLOAD,RESULT_STATUS, MATERIAL_ID,
       INBOUND_ISCOMPLETE, RESULT_DELETED, INBOUND_TIME, 
       INSERT_USERNAME, INSERT_TIME, UPDATE_USERNAME, 
       UPDATE_TIME, INSERT_UPDATE_REMARK, PERSONNEL_TEAM,
       PERSONNEL_SHIFTS)
     values (#{inboundId,jdbcType=DECIMAL}, #{inboundType,jdbcType=DECIMAL}, #{inboundNumber,jdbcType=VARCHAR},#{inboundDistributeId,jdbcType=DECIMAL},
-      #{gridId,jdbcType=DECIMAL},#{inboundGroupId,jdbcType=DECIMAL},#{personnelWorkshopid,jdbcType=DECIMAL},#{resultNumber,jdbcType=DECIMAL}, #{resultStatus,jdbcType=DECIMAL}, #{materialId,jdbcType=DECIMAL},
+      #{gridId,jdbcType=DECIMAL},#{inboundGroupId,jdbcType=DECIMAL},#{personnelWorkshopid,jdbcType=DECIMAL},#{resultNumber,jdbcType=DECIMAL},#{isupload,jdbcType=DECIMAL}, #{resultStatus,jdbcType=DECIMAL}, #{materialId,jdbcType=DECIMAL},
       #{inboundIscomplete,jdbcType=DECIMAL}, #{resultDeleted,jdbcType=DECIMAL}, #{inboundTime,jdbcType=TIMESTAMP}, 
       #{insertUsername,jdbcType=VARCHAR}, #{insertTime,jdbcType=TIMESTAMP}, #{updateUsername,jdbcType=VARCHAR}, 
       #{updateTime,jdbcType=TIMESTAMP}, #{insertUpdateRemark,jdbcType=VARCHAR}, #{personnelTeam,jdbcType=VARCHAR}, 
@@ -287,7 +299,9 @@
             <if test="resultNumber != null">
                 RESULT_NUMBER,
             </if>
-            
+            <if test="isupload != null">
+                ISUPLOAD,
+            </if>
             <if test="resultStatus != null">
                 RESULT_STATUS,
             </if>
@@ -352,7 +366,9 @@
             <if test="resultNumber != null">
                 #{resultNumber,jdbcType=DECIMAL},
             </if>
-            
+            <if test="isupload != null">
+                #{isupload,jdbcType=DECIMAL},
+            </if>
             <if test="resultStatus != null">
                 #{resultStatus,jdbcType=DECIMAL},
             </if>
@@ -399,6 +415,7 @@
       GRID_ID = #{gridId,jdbcType=DECIMAL},
       PERSONNEL_WORKSHOPID = #{personnelWorkshopid,jdbcType=DECIMAL},
       RESULT_NUMBER = #{resultNumber,jdbcType=DECIMAL},
+      ISUPLOAD = #{isupload,jdbcType=DECIMAL},
       INBOUND_GROUP_ID = #{inboundGroupId,jdbcType=DECIMAL},
       RESULT_STATUS = #{resultStatus,jdbcType=DECIMAL},
       MATERIAL_ID = #{materialId,jdbcType=DECIMAL},
@@ -441,6 +458,9 @@
             <if test="resultNumber != null">
                 RESULT_NUMBER = #{resultNumber,jdbcType=DECIMAL},
             </if>
+            <if test="isupload != null">
+                ISUPLOAD = #{isupload,jdbcType=DECIMAL},
+            </if>
             <if test="resultStatus != null">
                 RESULT_STATUS = #{resultStatus,jdbcType=DECIMAL},
             </if>
@@ -496,7 +516,7 @@
     <insert id="batchInsert" parameterType="java.util.List">
         insert into WMSP_INBOUND_RESULT
         (INBOUND_ID,
-        INBOUND_TYPE, INBOUND_NUMBER, GRID_ID,INBOUND_GROUP_ID,PERSONNEL_WORKSHOPID,RESULT_NUMBER,INBOUND_DISTRIBUTE_ID,
+        INBOUND_TYPE, INBOUND_NUMBER, GRID_ID,INBOUND_GROUP_ID,PERSONNEL_WORKSHOPID,RESULT_NUMBER,ISUPLOAD,INBOUND_DISTRIBUTE_ID,
         RESULT_STATUS, MATERIAL_ID, INBOUND_ISCOMPLETE,
         RESULT_DELETED, INBOUND_TIME,
         INSERT_USERNAME, INSERT_TIME,
@@ -507,7 +527,7 @@
         ( <foreach collection="list" item="item" separator="union all">
         select
         #{item.inboundId,jdbcType=DECIMAL},
-        #{item.inboundType,jdbcType=DECIMAL}, #{item.inboundNumber,jdbcType=VARCHAR}, #{item.inboundGroupId,jdbcType=DECIMAL}, #{item.gridId,jdbcType=DECIMAL}, #{item.personnelWorkshopid,jdbcType=DECIMAL}, #{item.resultNumber,jdbcType=DECIMAL}, #{item.inboundDistributeId,jdbcType=DECIMAL},
+        #{item.inboundType,jdbcType=DECIMAL}, #{item.inboundNumber,jdbcType=VARCHAR}, #{item.inboundGroupId,jdbcType=DECIMAL}, #{item.gridId,jdbcType=DECIMAL}, #{item.personnelWorkshopid,jdbcType=DECIMAL}, #{item.resultNumber,jdbcType=DECIMAL}, #{item.isupload,jdbcType=DECIMAL} , #{item.inboundDistributeId,jdbcType=DECIMAL},
         #{item.resultStatus,jdbcType=DECIMAL}, #{item.materialId,jdbcType=DECIMAL}, #{item.inboundIscomplete,jdbcType=DECIMAL},
         #{item.resultDeleted,jdbcType=DECIMAL}, #{item.inboundTime,jdbcType=TIMESTAMP},
         #{item.insertUsername,jdbcType=VARCHAR}, #{item.insertTime,jdbcType=TIMESTAMP},
@@ -553,7 +573,10 @@
         <foreach close="end" collection="list" index="index" item="item" open="case INBOUND_ID" separator=" ">
             when #{item.inboundId,jdbcType=DECIMAL} then #{item.resultNumber,jdbcType=DECIMAL}
         </foreach>
-        
+        ,ISUPLOAD=
+        <foreach close="end" collection="list" index="index" item="item" open="case INBOUND_ID" separator=" ">
+            when #{item.inboundId,jdbcType=DECIMAL} then #{item.isupload,jdbcType=DECIMAL}
+        </foreach>
         ,RESULT_STATUS=
         <foreach close="end" collection="list" index="index" item="item" open="case INBOUND_ID" separator=" ">
             when #{item.inboundId,jdbcType=DECIMAL} then #{item.resultStatus,jdbcType=DECIMAL}
@@ -650,6 +673,7 @@
         wir.inbound_type = 0
         AND wir.result_deleted = 0
         AND wir.INBOUND_ISCOMPLETE != 2
+        AND wir.ISUPLOAD='0'
         AND rpg.WAREHOUSE_ID = #{warehouseId}
         AND wgm.UPDATE_TIME IS NULL
         <if test="oneDate != null">
@@ -1509,7 +1533,9 @@
               where rms.material_id=(
                   select distinct rms2.material_id from rms_material_steel rms2
                   where material_steel_id =#{materialId}
-                ) and INBOUND_ISCOMPLETE='1'  and wgm.deleted ='0' and to_char(wir.insert_time,'YYYY-MM-DD')=TO_CHAR(SYSDATE,'YYYY-MM-DD')
+                )
+                and ( select distinct wosr.INBOUND_RESULT_ID from WMSP_OUTBOUND_SCAN_RESULT wosr where wosr.INBOUND_RESULT_ID =wir.INBOUND_ID ) is  null
+                and INBOUND_ISCOMPLETE='1' and wir.ISUPLOAD='0' and wgm.deleted ='0' and to_char(wir.insert_time,'YYYY-MM-DD')=TO_CHAR(SYSDATE,'YYYY-MM-DD')
               order by wir.insert_time desc
           ) where  Rownum='1'
         )