Commit 688b8c90647b9b5a00f9458b11a840f3c4c24be3

Authored by liufu
1 parent 8b5cbf30

同步

Showing 1 changed file with 30 additions and 9 deletions
HHWCS.Dao/Bll.cs
... ... @@ -146,11 +146,7 @@ namespace HHWCS.Bll
146 146 try
147 147 {
148 148 //检查参数
149   - if (String.IsNullOrEmpty(palletCode))
150   - {
151   - return BllResultFactory.Error<TaskEntity>(null, "托盘号不能为空");
152   - }
153   - else
  149 + if (!String.IsNullOrEmpty(palletCode))
154 150 {
155 151 //校验托盘,查看托盘是否存在任务未完成
156 152 int result = Convert.ToInt32(MySqlHelper.ExecuteScalar(AppCommon.ConnectionString, "SELECT count(*) from task where containerCode = @pallet and `status`<40 and warehouseId= @warehouseId", new MySqlParameter("@pallet", palletCode), new MySqlParameter("@warehouseId", AppCommon.WarehouseId)));
... ... @@ -165,9 +161,13 @@ namespace HHWCS.Bll
165 161 {
166 162 return BllResultFactory.Error<TaskEntity>(null, "对于整盘入库、空盘入库和移库目标库位不能为空");
167 163 }
  164 + else if (String.IsNullOrEmpty(palletCode))
  165 + {
  166 + return BllResultFactory.Error<TaskEntity>(null, "对于整盘入库、空盘入库和移库托盘号不能为空");
  167 + }
168 168 else
169 169 {
170   - var temp = Bll.CheckLocationForCreateTask(destinationLocation, AppCommon.WarehouseId);
  170 + var temp = Bll.CheckLocationForCreateTaskIn(destinationLocation, AppCommon.WarehouseId);
171 171 if (!temp.Success)
172 172 {
173 173 return temp;
... ... @@ -183,11 +183,32 @@ namespace HHWCS.Bll
183 183 else
184 184 {
185 185 //校验库位
186   - var temp = Bll.CheckLocationForCreateTask(sourceLocation, AppCommon.WarehouseId);
  186 + var temp = Bll.GetAllLocations(null, null, null, null, null, null, sourceLocation);
187 187 if (!temp.Success)
188 188 {
189   - return temp;
  189 + return BllResultFactory.Error<TaskEntity>(null, "未找到"+sourceLocation);
  190 + }
  191 + var location = temp.Data[0];
  192 + if (location.Status != "empty")
  193 + {
  194 + return BllResultFactory.Error<TaskEntity>(null,sourceLocation+"非空闲");
  195 + }
  196 + if (string.IsNullOrEmpty(location.ContainerCode))
  197 + {
  198 + return BllResultFactory.Error<TaskEntity>(null, sourceLocation +"没有托盘");
  199 + }
  200 + if (string.IsNullOrEmpty(palletCode))
  201 + {
  202 + palletCode = location.ContainerCode;
  203 + }
  204 + else
  205 + {
  206 + if (palletCode != location.ContainerCode)
  207 + {
  208 + return BllResultFactory.Error<TaskEntity>(null, sourceLocation + "库位托盘为"+location.ContainerCode+"与录入的"+palletCode+"不一致");
  209 + }
190 210 }
  211 +
191 212 }
192 213 }
193 214 mySqlConnection.Open();
... ... @@ -248,7 +269,7 @@ namespace HHWCS.Bll
248 269 }
249 270 }
250 271  
251   - private static BllResult<TaskEntity> CheckLocationForCreateTask(String code, int warehouseId)
  272 + private static BllResult<TaskEntity> CheckLocationForCreateTaskIn(String code, int warehouseId)
252 273 {
253 274 //校验库位
254 275 var ds = MySqlHelper.ExecuteDataset(AppCommon.ConnectionString, "SELECT * from location where `code` = @code and warehouseId = @warehouseId", new MySqlParameter("@code", code), new MySqlParameter("@warehouseId", AppCommon.WarehouseId));
... ...