Browse Source

lrl - 2021-09-27

lirl 3 years ago
parent
commit
e8a1360a1b

+ 6 - 3
src/main/java/com/steerinfo/ems/Utils/ExcelToolUtils.java

@@ -171,6 +171,7 @@ public class ExcelToolUtils {
         Row row = null;
         Cell cell = null;
         // 循环读取
+        try{
         for (int rowNum = startRow; rowNum <= lastRowNum; rowNum++) {
             row = sheet.getRow(rowNum);
             // 获取当前行的第一列和最后一列的标记(列数)
@@ -178,9 +179,6 @@ public class ExcelToolUtils {
             short lastCellNum = row.getLastCellNum();//最后一列
             if (lastCellNum != 0) {
                 String[] rowArray = new String[lastCellNum];
-                if(rowArray[0] == null || rowArray[0].equals("")){
-                    continue;
-                }
                 for (int cellNum = firstCellNum; cellNum < lastCellNum; cellNum++) {
                     cell = row.getCell(cellNum);
                     // 判断单元格是否有数据
@@ -190,10 +188,15 @@ public class ExcelToolUtils {
                         rowArray[cellNum] = parseCell(cell);
                     }
                 }
+                if(rowArray[0] != null || !rowArray[0].equals("")){
                     result.add(rowArray);
+                }
             }
         }
 
+        } catch (Exception e){
+            throw new MarketSlmException(500, "文件存在隐藏行或合并列!");
+        }
         return result;
     }
 

+ 2 - 2
src/main/java/com/steerinfo/ems/emsgmpcjh/mapper/EmsGmPcJhMapper.xml

@@ -572,7 +572,7 @@
       CREATE_MAN, CREATE_TIME, UPDATE_MAN, 
       UPDATE_TIME, MEMO, PURPOSE, 
       UNITID, DIMENSION, KXF_WEIGHT, 
-      YXF_WEIGHT, PLAN_WEIGHT)
+      YXF_WEIGHT, PLAN_WEIGHT,DELIVERY_DATE)
     ( <foreach collection="list" item="item" separator="union all"> 
    select  
       #{item.id,jdbcType=VARCHAR}, 
@@ -584,7 +584,7 @@
       #{item.createMan,jdbcType=VARCHAR}, #{item.createTime,jdbcType=TIMESTAMP}, #{item.updateMan,jdbcType=VARCHAR}, 
       #{item.updateTime,jdbcType=TIMESTAMP}, #{item.memo,jdbcType=VARCHAR}, #{item.purpose,jdbcType=VARCHAR}, 
       #{item.unitid,jdbcType=VARCHAR}, #{item.dimension,jdbcType=VARCHAR}, #{item.kxfWeight,jdbcType=DECIMAL}, 
-      #{item.yxfWeight,jdbcType=DECIMAL}, #{item.planWeight,jdbcType=DECIMAL} from dual  
+      #{item.yxfWeight,jdbcType=DECIMAL}, #{item.planWeight,jdbcType=DECIMAL}, #{item.deliveryDate,jdbcType=DECIMAL} from dual
    </foreach> )
   </insert>
   <update id="batchUpdate" parameterType="java.util.List">

+ 20 - 8
src/main/java/com/steerinfo/ems/emsgmpcjh/service/impl/EmsGmPcJhServiceImpl.java

@@ -5,6 +5,8 @@ import com.steerinfo.ems.Utils.MarketSlmException;
 import com.steerinfo.ems.emsgmpcjh.mapper.EmsGmPcJhMapper;
 import com.steerinfo.ems.emsgmpcjh.model.EmsGmPcJh;
 import com.steerinfo.ems.emsgmpcjh.service.IEmsGmPcJhService;
+import com.steerinfo.ems.emsprodplanweightadjustment.mapper.EmsProdplanWeightAdjustmentMapper;
+import com.steerinfo.ems.emsprodplanweightadjustment.model.EmsProdplanWeightAdjustment;
 import com.steerinfo.framework.controller.RESTfulResult;
 import com.steerinfo.framework.mapper.IBaseMapper;
 import com.steerinfo.framework.service.impl.BaseServiceImpl;
@@ -41,6 +43,8 @@ public class EmsGmPcJhServiceImpl extends BaseServiceImpl<EmsGmPcJh, String> imp
     @Autowired
     private EmsGmPcJhMapper emsGmPcJhMapper;
 
+    @Autowired
+    private EmsProdplanWeightAdjustmentMapper emsProdplanWeightAdjustmentMapper;
     @Override
     protected IBaseMapper<EmsGmPcJh, String> getMapper() {
         return emsGmPcJhMapper;
@@ -81,8 +85,8 @@ public class EmsGmPcJhServiceImpl extends BaseServiceImpl<EmsGmPcJh, String> imp
 
     @Override
     public RESTfulResult insertexcel(File file) throws Exception {
-        RESTfulResult rs = new RESTfulResult("200", "成功");
-        rs.setCode("0");
+        RESTfulResult rs = new RESTfulResult("200", "数据导入成功,不规范数据已自动剔除");
+        rs.setCode("200");
         List<EmsGmPcJh> lsp = null;
         try {
             lsp = createCheckCar(file);
@@ -91,6 +95,15 @@ public class EmsGmPcJhServiceImpl extends BaseServiceImpl<EmsGmPcJh, String> imp
                 int spm = emsGmPcJhMapper.batchInsert(lsp);
                 if (spm > 0) {
                     rs.setData(spm);
+                    EmsProdplanWeightAdjustment emsProdplanWeightAdjustment ;
+                    for (EmsGmPcJh emsGmPcJh : lsp) {
+                        emsProdplanWeightAdjustment = new EmsProdplanWeightAdjustment();
+                        emsProdplanWeightAdjustment.setId(emsGmPcJh.getId());
+                        emsProdplanWeightAdjustment.setAuditStatus("0");
+                        emsProdplanWeightAdjustment.setPlanWeight(emsGmPcJh.getPlanWeight());
+                        emsProdplanWeightAdjustment.setPlanWeightOld(emsGmPcJh.getPlanWeight());
+                        emsProdplanWeightAdjustmentMapper.insert(emsProdplanWeightAdjustment);
+                    }
                 } else {
                     rs.setMessage("导入失败");
                     rs.setCode("500");
@@ -159,12 +172,7 @@ public class EmsGmPcJhServiceImpl extends BaseServiceImpl<EmsGmPcJh, String> imp
             spp.setStartTime(arr[0]);
             switch (name) {
                 case "型钢" :
-                    if(arr[1].contains("一")){
-                        spp.setType("G-X1-");
-                        spp.setWorkprocType("AT2007");
-                    } else {
                         spp.setType("G-X2-");
-                    }
                     break;
                 case "钢坯" :
                     spp.setType("G-L1-");
@@ -192,7 +200,11 @@ public class EmsGmPcJhServiceImpl extends BaseServiceImpl<EmsGmPcJh, String> imp
             for(int j =1;j<arr1.length;j++) {
                 switch (arr1[j].trim()) {
                     case "规格" :
-                        spp.setSpecifications(arr[j].replace("*", "x"));
+                        if (name.equals("型钢")) {
+                            spp.setLengthTimesWidth(arr[j]);
+                        } else {
+                            spp.setSpecifications(arr[j]);
+                        }
                         break;
                     case "钢种" :
                         spp.setGrades(arr[j]);

+ 3 - 3
src/main/java/com/steerinfo/ems/emsprodplanround/controller/EmsProdplanRoundController.java

@@ -199,7 +199,7 @@ public class EmsProdplanRoundController extends BaseRESTfulController {
             if(model.getState().equals("1")){
                 return  failed(null,"存在已下发的计划,无法再次做下发");
             }
-            if (model.getAuditState().equals("3")) {
+            if (model.getState().equals("3")) {
                 return  failed(null,"存在审核不通过的计划, 无法下发");
             }
             model.setState("1");
@@ -260,9 +260,9 @@ public class EmsProdplanRoundController extends BaseRESTfulController {
     }
 
     @ApiOperation(value="获取详细信息", notes="根据url获取长度*宽度")
-    @GetMapping(value = "getlengthTimesWidth")
+    @GetMapping(value = "getbasespecbillet")
     public RESTfulResult getlengthTimesWidth(){
-        List<EmsProdplanRound> emsProdplanRounds = emsProdplanRoundService.getlengthTimesWidth();
+        List<EmsProdplanRound> emsProdplanRounds = emsProdplanRoundService.getbasespecbillet();
         return success(emsProdplanRounds);
     }
 

+ 1 - 1
src/main/java/com/steerinfo/ems/emsprodplanround/mapper/EmsProdplanRoundMapper.java

@@ -20,7 +20,7 @@ public interface EmsProdplanRoundMapper extends IBaseMapper<EmsProdplanRound, St
     //获取编号
     String getMaxidAsSC(EmsProdplanRound emsProdplanRound);
     //获取宽度*长度
-    List<EmsProdplanRound> getlengthTimesWidth();
+    List<EmsProdplanRound> getbasespecbillet();
     //获取断面
     List<EmsProdplanRound> getiateralArea();
     //获取断面

+ 4 - 3
src/main/java/com/steerinfo/ems/emsprodplanround/mapper/EmsProdplanRoundMapper.xml

@@ -733,9 +733,10 @@
     ID LIKE
     '%'||(SELECT  'N-' || substr(#{parentid}, 3) FROM dual )||'%'
   </select>
-  <select id="getlengthTimesWidth" resultMap="BaseResultMap">
-       select distinct LENGTH_TIMES_WIDTH from ems_prodplan_round
-           where LENGTH_TIMES_WIDTH not like '%null%'
+  <select id="getbasespecbillet" resultMap="BaseResultMap">
+       select distinct SPECIFICATIONS  from ems_gm_pc_jh
+           where SPECIFICATIONS not like '%null%'
+           and WORKPROC_TYPE = 'AT2007'
   </select>
   <!---->
   <select id="getiateralArea" resultMap="BaseResultMap">

+ 1 - 1
src/main/java/com/steerinfo/ems/emsprodplanround/service/IEmsProdplanRoundService.java

@@ -33,7 +33,7 @@ public interface IEmsProdplanRoundService extends IBaseService<EmsProdplanRound,
     //获取编号
     String getMaxidAsSC(EmsProdplanRound emsProdplanRound);
     //获取宽度*长度
-    List<EmsProdplanRound> getlengthTimesWidth();
+    List<EmsProdplanRound> getbasespecbillet();
     //获取断面
     List<EmsProdplanRound> getiateralArea();
     //获取断面

+ 2 - 2
src/main/java/com/steerinfo/ems/emsprodplanround/service/impl/EmsProdplanRoundServiceImpl.java

@@ -60,8 +60,8 @@ public class EmsProdplanRoundServiceImpl extends BaseServiceImpl<EmsProdplanRoun
     }
 
     @Override
-    public List<EmsProdplanRound> getlengthTimesWidth() {
-        return emsProdplanRoundMapper.getlengthTimesWidth();
+    public List<EmsProdplanRound> getbasespecbillet() {
+        return emsProdplanRoundMapper.getbasespecbillet();
     }
 
     @Override

+ 0 - 1
src/main/java/com/steerinfo/ems/emsprodplanweightadjustment/controller/EmsProdplanWeightAdjustmentController.java

@@ -295,7 +295,6 @@ public class EmsProdplanWeightAdjustmentController extends BaseRESTfulController
                 emsProdplanWeightAdjustment.setReviewerTime(new Date());
                 emsProdplanWeightAdjustment.setAuditStatus("4");
                 emsProdplanWeightAdjustmentMapper.updateByPrimaryKey(emsProdplanWeightAdjustment);
-
             }
         }
         return success();