Commit 4af744217282d00b5f56128cecaf4dda3cbb7226

Authored by 霍尔
1 parent e0df9384

PP片站台占用方面修改

WebApp/Apps/api/IStackerStatusApp.cs
... ... @@ -55,6 +55,21 @@ namespace WebApp
55 55 Response.Message = "重发";
56 56 return Response;
57 57 }
  58 + if (td.SourceLocation.Contains("ProductStationC0") && td.SourceLocation != "ProductStationC09")
  59 + {
  60 + Station stationEmpty = (from se in _unitWork.Find<Station>(n => n.IsEmpty == 1 && n.IsStop == 0 && n.Containercode != "")
  61 + join sts in _unitWork.Find<StationToStation>(a => a.EndStation == td.SourceLocation && a.StartStation.Contains("ProductStationC0"))
  62 + on se.Code equals sts.StartStation
  63 + select se).FirstOrDefault();
  64 + if (stationEmpty != null)
  65 + {
  66 + stationEmpty.Containercode = "";
  67 + stationEmpty.UpdateBy = "wms";
  68 + stationEmpty.UpdateTime = DateTime.Now;
  69 + _unitWork.Update(stationEmpty);
  70 + }
  71 + }
  72 +
58 73 Station station = _unitWork.Find<Station>(n => n.Code == td.SourceLocation && n.Containercode == td.ContainerCode).FirstOrDefault();
59 74 if (station != null)
60 75 {
... ...
WebApp/Apps/task/TaskApp.cs
... ... @@ -1411,10 +1411,11 @@ namespace WebApp
1411 1411 Station s = new Station();
1412 1412 if (station.Contains("ProductStationC0") && station != "ProductStationC09")
1413 1413 {
1414   - s = (from se in _unitWork.Find<Station>(n => n.IsEmpty == 1 && n.IsStop == 0 && n.Containercode == containerCode)
1415   - join sts in _unitWork.Find<StationToStation>(a => a.EndStation == station && a.StartStation.Contains("ProductStationC0"))
1416   - on se.Code equals sts.StartStation
1417   - select se).FirstOrDefault();
  1414 + //s = (from se in _unitWork.Find<Station>(n => n.IsEmpty == 1 && n.IsStop == 0 && n.Containercode == containerCode)
  1415 + // join sts in _unitWork.Find<StationToStation>(a => a.EndStation == station && a.StartStation.Contains("ProductStationC0"))
  1416 + // on se.Code equals sts.StartStation
  1417 + // select se).FirstOrDefault();
  1418 + s = _unitWork.Find<Station>(n => n.Code == station && n.Containercode != "").FirstOrDefault();
1418 1419 }
1419 1420 else
1420 1421 {
... ... @@ -1465,14 +1466,14 @@ namespace WebApp
1465 1466 response.msg = "失败:" + str;
1466 1467 return response;
1467 1468 }
1468   - if (station.Contains("ProductStationC0") && station != "ProductStationC09")
1469   - {
1470   - if (s != null)
1471   - {
1472   - s.Containercode = "";
1473   - _unitWork.Update(s);
1474   - }
1475   - }
  1469 + //if (station.Contains("ProductStationC0") && station != "ProductStationC09")
  1470 + //{
  1471 + // if (s != null)
  1472 + // {
  1473 + // s.Containercode = "";
  1474 + // _unitWork.Update(s);
  1475 + // }
  1476 + //}
1476 1477 }
1477 1478 else
1478 1479 {
... ... @@ -1581,8 +1582,9 @@ namespace WebApp
1581 1582 if (station.Contains("ProductStationC0") && station != "ProductStationC09")
1582 1583 {
1583 1584 //用PP片入库位置找出PP片空栈板补给仓位
1584   - StationToStation stationToStation = _unitWork.Find<StationToStation>(n => n.EndStation == station && n.StartStation.Contains("ProductStationC0")).FirstOrDefault();
1585   - s = _unitWork.Find<Station>(n => n.Code == stationToStation.StartStation && n.Containercode == containerCode).FirstOrDefault();
  1585 + //StationToStation stationToStation = _unitWork.Find<StationToStation>(n => n.EndStation == station && n.StartStation.Contains("ProductStationC0")).FirstOrDefault();
  1586 + //s = _unitWork.Find<Station>(n => n.Code == stationToStation.StartStation && n.Containercode == containerCode).FirstOrDefault();
  1587 + s = _unitWork.Find<Station>(n => n.Code == station && n.Containercode != "").FirstOrDefault();
1586 1588 }
1587 1589 else
1588 1590 {
... ... @@ -2082,8 +2084,19 @@ namespace WebApp
2082 2084 if (station.Contains("ProductStationC0") && station != "ProductStationC09")
2083 2085 {
2084 2086 //用PP片入库位置找出PP片空栈板补给仓位
2085   - StationToStation stationToStation = _unitWork.Find<StationToStation>(n => n.EndStation == station && n.StartStation.Contains("ProductStationC0")).FirstOrDefault();
2086   - Station = _unitWork.Find<Station>(n => n.Code == stationToStation.StartStation).FirstOrDefault();
  2087 + //StationToStation stationToStation = _unitWork.Find<StationToStation>(n => n.EndStation == station && n.StartStation.Contains("ProductStationC0")).FirstOrDefault();
  2088 + Station s = (from se in _unitWork.Find<Station>(n => n.IsEmpty == 1 && n.IsStop == 0 && n.Containercode == Pallet)
  2089 + join sts in _unitWork.Find<StationToStation>(a => a.EndStation == station && a.StartStation.Contains("ProductStationC0"))
  2090 + on se.Code equals sts.StartStation
  2091 + select se).FirstOrDefault();
  2092 + Station = _unitWork.Find<Station>(n => n.Code == station).FirstOrDefault();
  2093 + if (s != null)
  2094 + {
  2095 + s.Containercode = "";
  2096 + s.UpdateBy = "wms";
  2097 + s.UpdateTime = DateTime.Now;
  2098 + _unitWork.Update(s);
  2099 + }
2087 2100 }
2088 2101 else
2089 2102 {
... ... @@ -2105,208 +2118,61 @@ namespace WebApp
2105 2118 tab.data = "没有找到站台";
2106 2119 return tab;
2107 2120 }
2108   - if (station == "ProductStationC10")
2109   - {
2110   - TaskDetail taskDetail = _unitWork.Find<TaskDetail>(n => n.ContainerCode == Station.Containercode && n.Status >= TaskStatus.新建任务 && n.Status < TaskStatus.已经完成).FirstOrDefault();
2111   - if (taskDetail == null)
2112   - {
2113   - tab.code = 300;
2114   - tab.data = "错误:托盘号" + Station.Containercode + "还在占用该站台,请先为" + Station.Containercode + "托盘创建回库任务";
2115   - return tab;
2116   - }
2117   - else if (taskDetail.Status == TaskStatus.新建任务)
2118   - {
2119   - tab.code = 300;
2120   - tab.data = "错误:托盘号" + Station.Containercode + "任务已经创建,但还未下发,青等待30秒后再操作";
2121   - return tab;
2122   - }
2123   - else
2124   - {
2125   - Station.Containercode = Pallet;
2126   - _unitWork.Update(Station);
2127   - }
2128   - }
2129   - int? roadway = _unitWork.Find<StationRoadway>(n => n.StationCode == Station.Code).Select(a => a.RoadWay).FirstOrDefault();
2130   - if (roadway == 3)
  2121 + if (station == "ProductStationC10" && Station.Containercode != "")
2131 2122 {
2132   - if (Station.Containercode != "")
2133   - {
2134   - var OldPalletTwo = Station.Containercode.Substring(0, 2);
2135   - if (OldPalletTwo != "PP")
2136   - {
2137   - Container Con = _unitWork.Find<Container>(n => n.Code == Station.Containercode).FirstOrDefault();
2138   - Location Loc = _unitWork.Find<Location>(n => n.ContainerCode == Station.Containercode).FirstOrDefault();
2139   - Inventory Inv = _unitWork.Find<Inventory>(n => n.ContainerCode == Station.Containercode).FirstOrDefault();
2140   - if (Con != null) {
2141   - _unitWork.Delete(Con);
2142   - }
2143   - if (Loc != null)
2144   - {
2145   - _unitWork.Update<Location>(n => n.ContainerCode == Station.Containercode, n => new Location
2146   - {
2147   - Status = LocationStatus.空仓位,
2148   - ContainerCode = ""
2149   - });
2150   -
2151   - }
2152   - if (Inv != null)
2153   - {
2154   - _unitWork.Delete(Inv);
2155   -
2156   - }
2157   - Container Container = _unitWork.Find<Container>(n => n.Code == Pallet).FirstOrDefault();
2158   - if (Container == null)
2159   - {
2160   - Container con = new Container
2161   - {
2162   - Code = Pallet,
2163   - IsLock = ContainerLock.任务锁,
2164   - Status = ContainerStatus.空,
2165   - Type = ContainerType.普通栈板,
2166   - PrintCount = 0
2167   - };
2168   - _unitWork.Add(con);
2169   - }
2170   - Station.Containercode = Pallet;
2171   - _unitWork.Update(Station);
2172   - }
2173   - else
  2123 + if (Station.Containercode != Pallet) {
  2124 + TaskDetail taskDetail = _unitWork.Find<TaskDetail>(n => n.ContainerCode == Station.Containercode && n.Status >= TaskStatus.新建任务 && n.Status < TaskStatus.已经完成).FirstOrDefault();
  2125 + if (taskDetail == null)
2174 2126 {
2175   - if (Station.Containercode == Pallet)
2176   - {
2177   - tab.data = "托盘号正确";
2178   - return tab;
2179   - }
2180   - else
2181   - {
2182   - tab.code = 300;
2183   - tab.data = "托盘号错误,站台数据托盘为:" + Station.Containercode + "</br>扫描到的托盘号为:" + Pallet + "";
2184   - return tab;
2185   - }
2186   - }
2187   -
2188   - }
2189   - else
2190   - {
2191   - Container Container = _unitWork.Find<Container>(n => n.Code == Pallet).FirstOrDefault();
2192   - if (Container == null)
2193   - {
2194   - Container con = new Container
2195   - {
2196   - Code = Pallet,
2197   - IsLock = ContainerLock.任务锁,
2198   - Status = ContainerStatus.空,
2199   - Type = ContainerType.普通栈板,
2200   - PrintCount = 0
2201   - };
2202   - _unitWork.Add(con);
  2127 + tab.code = 300;
  2128 + tab.data = "错误:托盘号" + Station.Containercode + "还在占用该站台,请先为" + Station.Containercode + "托盘创建回库任务";
  2129 + return tab;
2203 2130 }
2204   - else if (Container != null && Container.IsLock == ContainerLock.未锁)
  2131 + else if (taskDetail.Status < TaskStatus.下达任务)
2205 2132 {
2206 2133 tab.code = 300;
2207   - tab.data = "库内已有该托盘";
  2134 + tab.data = "错误:托盘号" + Station.Containercode + "任务已经创建</br>但还未下发,请等待30秒后再操作";
2208 2135 return tab;
2209 2136 }
2210   - Station.Containercode = Pallet;
2211   - _unitWork.Update(Station);
  2137 + else
  2138 + {
  2139 + Station.Containercode = Pallet;
  2140 + _unitWork.Update(Station);
  2141 + }
  2142 +
2212 2143 }
2213 2144 }
2214   - else {
2215   - //if (station == "ProductStationC10")
2216   - //{
2217   - // if (Station.Containercode == "")
2218   - // {
2219   - // Container Container = _unitWork.Find<Container>(n => n.Code == Pallet).FirstOrDefault();
2220   - // if (Container == null)
2221   - // {
2222   - // Container con = new Container
2223   - // {
2224   - // Code = Pallet,
2225   - // IsLock = ContainerLock.任务锁,
2226   - // Status = ContainerStatus.空,
2227   - // Type = ContainerType.普通栈板,
2228   - // PrintCount = 0
2229   - // };
2230   - // _unitWork.Add(con);
2231   - // }
2232   - // else if (Container != null && Container.IsLock == ContainerLock.未锁)
2233   - // {
2234   - // tab.code = 300;
2235   - // tab.data = "库内已有该托盘";
2236   - // return tab;
2237   - // }
2238   - // Station.Containercode = Pallet;
2239   - // _unitWork.Update(Station);
2240   - // }
2241   - // else
2242   - // {
2243   - // TaskDetail taskDetail = _unitWork.Find<TaskDetail>(n => n.ContainerCode == Station.Containercode && n.Status >= TaskStatus.新建任务 && n.Status < TaskStatus.已经完成).FirstOrDefault();
2244   - // if (taskDetail == null)
2245   - // {
2246   - // tab.code = 300;
2247   - // tab.data = "错误:托盘号" + Station.Containercode + "还在占用该站台,没有创建回库任务";
2248   - // return tab;
2249   - // }
2250   - // else if (taskDetail.Status == TaskStatus.新建任务)
2251   - // {
2252   - // tab.code = 300;
2253   - // tab.data = "错误:托盘号" + Station.Containercode + "回库任务还未下发,青等待30秒后再操作";
2254   - // return tab;
2255   - // }
2256   - // else
2257   - // {
2258   - // Station.Containercode = Pallet;
2259   - // _unitWork.Update(Station);
2260   - // }
2261   -
2262   - // }
2263   -
2264   - //}
2265   - //else
2266   - //{
2267   - if (Station.Containercode == "")
  2145 + if (Station.Containercode == "" || Station.Containercode == Pallet)
  2146 + {
  2147 + Container Container = _unitWork.Find<Container>(n => n.Code == Pallet).FirstOrDefault();
  2148 + if (Container == null)
  2149 + {
  2150 + Container con = new Container
2268 2151 {
2269   - Container Container = _unitWork.Find<Container>(n => n.Code == Pallet).FirstOrDefault();
2270   - if (Container == null)
2271   - {
2272   - Container con = new Container
2273   - {
2274   - Code = Pallet,
  2152 + Code = Pallet,
2275 2153 IsLock = ContainerLock.任务锁,
2276 2154 Status = ContainerStatus.空,
2277 2155 Type = ContainerType.普通栈板,
2278 2156 PrintCount = 0
2279   - };
2280   - _unitWork.Add(con);
2281   - }
2282   - else if (Container != null && Container.IsLock == ContainerLock.未锁)
2283   - {
2284   - tab.code = 300;
2285   - tab.data = "库内已有该托盘";
2286   - return tab;
2287   - }
2288   - Station.Containercode = Pallet;
2289   - _unitWork.Update(Station);
2290   - }
2291   - else
2292   - {
2293   - if (Station.Containercode == Pallet)
2294   - {
2295   - tab.data = "托盘号正确";
2296   - return tab;
2297   - }
2298   - else
2299   - {
2300   - tab.code = 300;
2301   - tab.data = "托盘号错误,站台数据托盘为:" + Station.Containercode + "</br>扫描到的托盘号为:" + Pallet + "";
2302   - return tab;
2303   - }
2304   - }
2305   - //}
2306   - }
2307   - //Station Station = _unitWork.Find<Station>(n => n.Code == station).FirstOrDefault();
2308   -
2309   -
  2157 + };
  2158 + _unitWork.Add(con);
  2159 + Station.Containercode = Pallet;
  2160 + _unitWork.Update(Station);
  2161 + }
  2162 + else if (Container != null && Container.IsLock == ContainerLock.未锁)
  2163 + {
  2164 + tab.code = 300;
  2165 + tab.data = "库内已有该托盘";
  2166 + return tab;
  2167 + }
  2168 +
  2169 + }
  2170 + else
  2171 + {
  2172 + tab.code = 300;
  2173 + tab.data = "托盘号错误,站台数据托盘为:" + Station.Containercode + "</br>扫描到的托盘号为:" + Pallet + "";
  2174 + return tab;
  2175 + }
2310 2176  
2311 2177 }
2312 2178 catch (Exception ex)
... ...
WebMvc/Areas/job/JobAction/SendWmsTaskAction.cs
... ... @@ -54,7 +54,7 @@ namespace WebMvc
54 54 sd.Qty = decimal.Parse(dr["qty"].ToString());
55 55 Station = dr["station"].ToString();
56 56 sd.Status = short.Parse(dr["status"].ToString());
57   - sd.QtyDivided = short.Parse(dr["qtyDivided"].ToString());
  57 + sd.QtyDivided = decimal.Parse(dr["qtyDivided"].ToString());
58 58 Priority = int.Parse(dr["priority"].ToString());
59 59 str = AddTaskInfo(sd, Station, Priority);
60 60 //如果任务没有报错
... ...