fanxw 5 år sedan
förälder
incheckning
688e30dc80

+ 0 - 6
src/main/java/com/chinaitop/depot/basic/controller/BasicTankController.java

@@ -86,12 +86,6 @@ public class BasicTankController {
86 86
         return pageInfo;
87 87
     }
88 88
 
89
-    /**
90
-     * 更新油罐信息
91
-     *
92
-     * @param tankJson JSON数据对象
93
-     * @return
94
-     */
95 89
     @RequestMapping(value = "/edit", produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.POST)
96 90
     @ApiOperation(value="更新油罐信息", notes = "更新油罐信息")
97 91
     @ApiImplicitParams({

+ 23 - 6
src/main/java/com/chinaitop/depot/basic/mapper/BasicStorehouseMapper.xml

@@ -69,6 +69,7 @@
69 69
     <result column="updatetime" jdbcType="TIMESTAMP" property="updatetime" />
70 70
     <result column="cfbm" jdbcType="VARCHAR" property="cfbm" />
71 71
     <result column="ajbm" jdbcType="VARCHAR" property="ajbm" />
72
+    <result column="datatype" jdbcType="VARCHAR" property="datatype" />
72 73
   </resultMap>
73 74
   <sql id="Example_Where_Clause">
74 75
     <where>
@@ -138,7 +139,8 @@
138 139
     draftType, heatInsulationStep_roof, heatInsulationStep_window, grbwcs, nfszcc, ywfsfqfczz, 
139 140
     ywfhfbfdss, ywlqjcss, ywjxtfss, nfhlxzsc, nffddyqtcl, nfcwcc, actual_capacity, completion_date, 
140 141
     useDate, storehouse_state, store_way, currentType, dutyStoreman, remark, createName, 
141
-    createDate, updateName, updateDate, working_status, del_flag, library_type, updatetime, cfbm, ajbm
142
+    createDate, updateName, updateDate, working_status, del_flag, library_type, updatetime, cfbm, ajbm,
143
+    datatype
142 144
   </sql>
143 145
   <select id="selectByExample" parameterType="com.chinaitop.depot.basic.model.BasicStorehouseExample" resultMap="BaseResultMap">
144 146
     select
@@ -193,7 +195,7 @@
193 195
       dutyStoreman, remark, createName, 
194 196
       createDate, updateName, updateDate, 
195 197
       working_status, del_flag, library_type, 
196
-      updatetime, cfbm, ajbm)
198
+      updatetime, cfbm, ajbm, datatype)
197 199
     values (#{storehouseId,jdbcType=INTEGER}, #{uuid,jdbcType=VARCHAR}, #{depotId,jdbcType=INTEGER}, 
198 200
       #{depotName,jdbcType=VARCHAR}, #{orgId,jdbcType=INTEGER}, #{orgName,jdbcType=VARCHAR}, 
199 201
       #{storehouseCode,jdbcType=VARCHAR}, #{storehouseName,jdbcType=VARCHAR}, #{storehouseType,jdbcType=INTEGER}, 
@@ -216,7 +218,8 @@
216 218
       #{dutystoreman,jdbcType=VARCHAR}, #{remark,jdbcType=VARCHAR}, #{createname,jdbcType=VARCHAR}, 
217 219
       #{createdate,jdbcType=TIMESTAMP}, #{updatename,jdbcType=VARCHAR}, #{updatedate,jdbcType=TIMESTAMP}, 
218 220
       #{workingStatus,jdbcType=INTEGER}, #{delFlag,jdbcType=INTEGER}, #{libraryType,jdbcType=VARCHAR}, 
219
-      #{updatetime,jdbcType=TIMESTAMP}, #{cfbm,jdbcType=VARCHAR}, #{ajbm,jdbcType=VARCHAR})
221
+      #{updatetime,jdbcType=TIMESTAMP}, #{cfbm,jdbcType=VARCHAR}, #{ajbm,jdbcType=VARCHAR},
222
+      #{datatype,jdbcType=VARCHAR})
220 223
   </insert>
221 224
   <insert id="insertSelective" parameterType="com.chinaitop.depot.basic.model.BasicStorehouse" keyProperty="storehouseId" useGeneratedKeys="true">
222 225
     insert into basic_storehouse
@@ -422,6 +425,9 @@
422 425
       <if test="ajbm != null">
423 426
         ajbm,
424 427
       </if>
428
+      <if test="datatype != null">
429
+       datatype,
430
+      </if>
425 431
     </trim>
426 432
     <trim prefix="values (" suffix=")" suffixOverrides=",">
427 433
       <if test="storehouseId != null">
@@ -625,6 +631,9 @@
625 631
       <if test="ajbm != null">
626 632
         #{ajbm,jdbcType=VARCHAR},
627 633
       </if>
634
+      <if test="datatype != null">
635
+       #{datatype,jdbcType=VARCHAR},
636
+      </if>
628 637
     </trim>
629 638
   </insert>
630 639
   <select id="countByExample" parameterType="com.chinaitop.depot.basic.model.BasicStorehouseExample" resultType="java.lang.Integer">
@@ -837,6 +846,9 @@
837 846
       <if test="record.ajbm != null">
838 847
         ajbm = #{record.ajbm,jdbcType=VARCHAR},
839 848
       </if>
849
+      <if test="record.datatype != null">
850
+       datatype = #{record.datatype,jdbcType=VARCHAR},
851
+      </if>
840 852
     </set>
841 853
     <if test="_parameter != null">
842 854
       <include refid="Update_By_Example_Where_Clause" />
@@ -910,7 +922,8 @@
910 922
       library_type = #{record.libraryType,jdbcType=VARCHAR},
911 923
       updatetime = #{record.updatetime,jdbcType=TIMESTAMP},
912 924
       cfbm = #{record.cfbm,jdbcType=VARCHAR},
913
-      ajbm = #{record.ajbm,jdbcType=VARCHAR}
925
+      ajbm = #{record.ajbm,jdbcType=VARCHAR},
926
+      datatype = #{record.datatype,jdbcType=VARCHAR}
914 927
     <if test="_parameter != null">
915 928
       <include refid="Update_By_Example_Where_Clause" />
916 929
     </if>
@@ -1111,11 +1124,14 @@
1111 1124
         updatetime = #{updatetime,jdbcType=TIMESTAMP},
1112 1125
       </if>
1113 1126
       <if test="cfbm != null">
1114
-        cfbm = #{datatype,cfbm=VARCHAR},
1127
+        cfbm = #{cfbm,jdbcType=VARCHAR},
1115 1128
       </if>
1116 1129
       <if test="ajbm != null">
1117 1130
         ajbm = #{ajbm,jdbcType=VARCHAR},
1118 1131
       </if>
1132
+      <if test="datatype != null">
1133
+       datatype = #{datatype,jdbcType=VARCHAR},
1134
+      </if>
1119 1135
     </set>
1120 1136
     where storehouse_id = #{storehouseId,jdbcType=INTEGER}
1121 1137
   </update>
@@ -1186,7 +1202,8 @@
1186 1202
       library_type = #{libraryType,jdbcType=VARCHAR},
1187 1203
       updatetime = #{updatetime,jdbcType=TIMESTAMP},
1188 1204
       cfbm = #{cfbm,jdbcType=VARCHAR},
1189
-      ajbm = #{ajbm,jdbcType=VARCHAR}
1205
+      ajbm = #{ajbm,jdbcType=VARCHAR},
1206
+      datatype = #{datatype,jdbcType=VARCHAR}
1190 1207
     where storehouse_id = #{storehouseId,jdbcType=INTEGER}
1191 1208
   </update>
1192 1209
 

+ 10 - 0
src/main/java/com/chinaitop/depot/basic/model/BasicStorehouse.java

@@ -139,6 +139,8 @@ public class BasicStorehouse {
139 139
     private String cfbm;
140 140
 
141 141
     private String ajbm;
142
+    
143
+    private String datatype;
142 144
 
143 145
     /**
144 146
      * ID
@@ -1204,4 +1206,12 @@ public class BasicStorehouse {
1204 1206
 		this.ajbm = ajbm;
1205 1207
 	}
1206 1208
 
1209
+	public String getDatatype() {
1210
+		return datatype;
1211
+	}
1212
+
1213
+	public void setDatatype(String datatype) {
1214
+		this.datatype = datatype;
1215
+	}
1216
+
1207 1217
 }

+ 38 - 6
src/main/java/com/chinaitop/depot/basic/service/impl/BasicTankServiceImpl.java

@@ -1,6 +1,7 @@
1 1
 package com.chinaitop.depot.basic.service.impl;
2 2
 
3 3
 import java.math.BigDecimal;
4
+import java.util.Date;
4 5
 import java.util.HashMap;
5 6
 import java.util.List;
6 7
 import java.util.Map;
@@ -18,6 +19,7 @@ import com.chinaitop.depot.basic.mapper.BasicTankHwMapper;
18 19
 import com.chinaitop.depot.basic.mapper.BasicTankMapper;
19 20
 import com.chinaitop.depot.basic.model.BasicEnum;
20 21
 import com.chinaitop.depot.basic.model.BasicEnumExample;
22
+import com.chinaitop.depot.basic.model.BasicStorehouse;
21 23
 import com.chinaitop.depot.basic.model.BasicTank;
22 24
 import com.chinaitop.depot.basic.model.BasicTankExample;
23 25
 import com.chinaitop.depot.basic.model.BasicTankHw;
@@ -92,22 +94,52 @@ public class BasicTankServiceImpl implements BasicTankService {
92 94
 		String ajbm = "";//廒间编码
93 95
 
94 96
 		if (!"".equals(basicTank.getStoragetankCode())) {
95
-			//String code = basicTank.getStoragetankCode().toString().substring(2, 5);
96
-			ygbm = BusinessUtils.setBZcfandygbm(dwdm, basicTank.getStoragetankCode(), "1");
97
+			String code = basicTank.getStoragetankCode().toString().substring(2, 5);
98
+			ygbm = BusinessUtils.setBZcfandygbm(dwdm, code, "1");
97 99
 			ajbm = BusinessUtils.setBZajbm(ygbm, "", "1");
98 100
 			basicTank.setYgdm(ygbm);
99 101
 			basicTank.setYgajdm(ajbm);
100 102
 		}
101 103
         if(basicTank.getId() == null || "".equals(basicTank.getId())){
102
-        	basicTankMapper.insertSelective(basicTank);
104
+        	BasicStorehouse storehouse = new BasicStorehouse();
105
+        	storehouse.setStorehouseCode(basicTank.getStoragetankCode());
106
+        	storehouse.setStorehouseName(basicTank.getStoragetankName());
107
+        	storehouse.setOrgId(basicTank.getOrgId());
108
+        	storehouse.setDatatype("1");
109
+        	storehouse.setDelFlag(1);
110
+        	storehouse.setCreatedate(new Date());
111
+        	storehouse.setLibraryType("0");
112
+        	storehouse.setCfbm(basicTank.getYgdm());
113
+        	storehouse.setAjbm(basicTank.getYgajdm());
114
+        	int count = basicStorehouseMapper.insertSelective(storehouse);
115
+        	if (count > 0) {
116
+        		basicTank.setId(storehouse.getStorehouseId());
117
+        		basicTankMapper.insertSelective(basicTank);
118
+        		
119
+        		tankhw.setId(basicTank.getId());
120
+        		tankhw.setHwbm(BusinessUtils.setBZhwbm(basicTank.getYgajdm(), "01"));
121
+        		basicTankHwMapper.insertSelective(tankhw);
122
+        	}
103 123
 
104
-        	tankhw.setId(basicTank.getId());
105
-        	tankhw.setHwbm(BusinessUtils.setBZhwbm(basicTank.getYgajdm(), "01"));
106
-        	basicTankHwMapper.insertSelective(tankhw);
107 124
 		}else{
125
+			int count = basicTankMapper.updateByPrimaryKeySelective(basicTank);
108 126
 			if (!"".equals(basicTank.getStoragetankCode())) {
109 127
 				tankhw.setHwbm(BusinessUtils.setBZhwbm(basicTank.getYgajdm(), "01"));
110 128
 			}
129
+			//油罐表修改成功后修改仓房表中对应的油罐数据
130
+			if (count > 0) {
131
+				BasicStorehouse storehouse = new BasicStorehouse();
132
+				storehouse.setStorehouseId(basicTank.getId());
133
+				storehouse.setStorehouseName(basicTank.getStoragetankName());
134
+				storehouse.setStorehouseCode(basicTank.getStoragetankCode());
135
+				storehouse.setDelFlag(basicTank.getDelFlag());
136
+				storehouse.setCfbm(basicTank.getYgdm());
137
+	        	storehouse.setAjbm(basicTank.getYgajdm());
138
+				basicStorehouseMapper.updateByPrimaryKeySelective(storehouse);
139
+			}
140
+			//修改油罐货位表
141
+			tankhw.setCzbz("u");
142
+			tankhw.setZhgxsj(new Date());
111 143
 			BasicTankHwExample example = new BasicTankHwExample();
112 144
 			BasicTankHwExample.Criteria criteria = example.createCriteria();
113 145
 			criteria.andIdEqualTo(basicTank.getId());

+ 1 - 1
src/main/java/com/chinaitop/depot/utils/BusinessUtils.java

@@ -11,7 +11,7 @@ public class BusinessUtils {
11 11
 	//简易简易仓、简易囤、罩棚的3位廒间编码
12 12
 	private final static String JY_CODE = "999";
13 13
 
14
-	//简易简易仓、简易囤、罩棚的3位廒间编码
14
+	//油罐廒间编码
15 15
 	private final static String YG_CODE = "000";
16 16
 
17 17
 	//油罐