InsertingExtend.cs 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388
  1. 
  2. namespace UFIDA.U9.Cust.Kusi.CJJ.Plugin.BE.BarCodeUsed
  3. {
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Text;
  7. using UFIDA.U9.Base;
  8. using UFIDA.U9.Complete.CompleteBE.Pub_Util;
  9. using UFSoft.UBF.Business;
  10. public partial class Inserting
  11. {
  12. class WhBinInfo
  13. {
  14. public long WhID { get; set; }
  15. public string WhName { get; set; }
  16. public string WhCode { get; set; }
  17. public long BinID { get; set; }
  18. public string BinName { get; set; }
  19. public string BinCode { get; set; }
  20. public WhBinInfo()
  21. {
  22. WhID = -1;
  23. WhName = "";
  24. WhCode = "";
  25. BinID = -1;
  26. BinCode = "";
  27. BinName = "";
  28. }
  29. }
  30. private void Do_Notify(object[] args)
  31. {
  32. #region 从事件参数中取得当前业务实体
  33. if (args == null || args.Length == 0 || !(args[0] is UFSoft.UBF.Business.EntityEvent))
  34. return;
  35. BusinessEntity.EntityKey key = ((UFSoft.UBF.Business.EntityEvent)args[0]).EntityKey;
  36. if (key == null)
  37. return;
  38. UFIDA.U9.BC.BaseData.BarCodeUsed holder = key.GetEntity() as UFIDA.U9.BC.BaseData.BarCodeUsed;
  39. if (holder == null)
  40. return;
  41. #endregion
  42. WhBinInfo info = GetWhBinInfo(holder);
  43. holder.SetValue("Cust4Whid", info.WhID);
  44. holder.SetValue("Cust4Whcode", info.WhCode);
  45. holder.SetValue("Cust4Whname", info.WhName);
  46. holder.SetValue("Cust4Binid", info.BinID);
  47. holder.SetValue("Cust4Bincode", info.BinCode);
  48. holder.SetValue("Cust4Binname", info.BinName);
  49. holder.BarCodeMaster.SetValue("Cust4Whid", info.WhID);
  50. holder.BarCodeMaster.SetValue("Cust4Whcode", info.WhCode);
  51. holder.BarCodeMaster.SetValue("Cust4Whname", info.WhName);
  52. holder.BarCodeMaster.SetValue("Cust4Binid", info.BinID);
  53. holder.BarCodeMaster.SetValue("Cust4Bincode", info.BinCode);
  54. holder.BarCodeMaster.SetValue("Cust4Binname", info.BinName);
  55. }
  56. private WhBinInfo GetWhBinInfo(UFIDA.U9.BC.BaseData.BarCodeUsed holder)
  57. {
  58. WhBinInfo info = new WhBinInfo();
  59. if (holder.CreateEntity != null)
  60. {
  61. BusinessEntity entity = new BusinessEntity.EntityKey(holder.CreateEntity.EntityID, holder.CreateEntity.EntityType).GetEntity();
  62. if (entity != null)
  63. {
  64. switch (holder.CreateEntity.EntityType)
  65. {
  66. //case "UFIDA.U9.Complete.RCVRpt.RcvRptDocLine":
  67. // FromRcvRptDocLine(entity, info);
  68. // break;
  69. //case "UFIDA.U9.PM.Rcv.RcvLine":
  70. // FromRcvLine(entity, info);
  71. // break;
  72. //case "UFIDA.U9.InvDoc.MiscRcv.MiscRcvTransL":
  73. // FromMiscRcvTransL(entity, info);
  74. // break;
  75. //case "UFIDA.U9.InvDoc.TransferIn.TransInLine":
  76. // FromTransInLine(entity, info);
  77. // break;
  78. //case "UFIDA.U9.InvDoc.InventorySheet.InventSheetLine":
  79. // FromInventSheetLine(entity, info);
  80. // break;
  81. //case "UFIDA.U9.SM.Ship.ShipLine":
  82. // FromShipLine(entity, info);
  83. // break;
  84. //case "UFIDA.U9.InvDoc.MiscShip.MiscShipmentL":
  85. // FromMiscShipmentL(entity, info);
  86. // break;
  87. //case "UFIDA::U9::MO::Issue::IssueDocLine":
  88. // FromIssueDocLine(entity, info);
  89. // break;
  90. //case "UFIDA::U9::MO::Issue::IssueDocLineSum":
  91. // FromIssueDocLineSum(entity, info);
  92. // break;
  93. //case "UFIDA.U9.InvDoc.WhInit.WhInitLine":
  94. // FromWhInitLine(entity, info);
  95. // break;
  96. case "UFIDA.U9.InvDoc.TransferForm.TransferFormL":
  97. FromTransferFormLine(entity, info);
  98. break;
  99. //case "UFIDA.U9.InvDoc.TransferIn.TransInSubLine":
  100. // FromTransferFormSLine(entity, info);
  101. // break;
  102. }
  103. }
  104. }
  105. return info;
  106. }
  107. private void FromTransferFormLine(BusinessEntity entity, WhBinInfo info)
  108. {
  109. if (entity is UFIDA.U9.InvDoc.TransferForm.TransferFormL line)
  110. {
  111. if (line.Wh != null)
  112. {
  113. info.WhID = line.Wh.ID;
  114. info.WhCode = line.Wh.Code;
  115. info.WhName = line.Wh.Name;
  116. }
  117. if (line.BinInfo!=null)
  118. {
  119. if (line.BinInfo.Bin!=null)
  120. {
  121. info.BinID = line.BinInfo.Bin.ID;
  122. info.BinCode = line.BinInfo.Bin.Code;
  123. info.BinName = line.BinInfo.Bin.Name;
  124. }
  125. }
  126. }
  127. }
  128. private void FromTransferFormSLine(BusinessEntity entity, WhBinInfo info)
  129. {
  130. if (entity is UFIDA.U9.InvDoc.TransferIn.TransInSubLine subline)
  131. {
  132. if (subline.TransInLine.TransInWh != null)
  133. {
  134. info.WhID = subline.TransInLine.TransInWh.ID;
  135. info.WhCode = subline.TransInLine.TransInWh.Code;
  136. info.WhName = subline.TransInLine.TransInWh.Name;
  137. }
  138. if (subline.TransInLine.TransInBins != null)
  139. {
  140. foreach (var binInfo in subline.TransInLine.TransInBins)
  141. {
  142. info.BinID = binInfo.BinInfo.Bin.ID;
  143. info.BinCode = binInfo.BinInfo.Bin.Code;
  144. info.BinName = binInfo.BinInfo.Bin.Name;
  145. }
  146. }
  147. }
  148. }
  149. private void FromRcvRptDocLine(BusinessEntity entity, WhBinInfo info)
  150. {
  151. if (entity is Complete.RCVRpt.RcvRptDocLine line)
  152. {
  153. if (line.Wh != null)
  154. {
  155. info.WhID = line.Wh.ID;
  156. info.WhCode = line.Wh.Code;
  157. info.WhName = line.Wh.Name;
  158. }
  159. if (line.Bin != null)
  160. {
  161. info.BinID = line.Bin.ID;
  162. info.BinCode = line.Bin.Code;
  163. info.BinName = line.Bin.Name;
  164. }
  165. }
  166. }
  167. private void FromRcvLine(BusinessEntity entity, WhBinInfo info)
  168. {
  169. if (entity is PM.Rcv.RcvLine line)
  170. {
  171. if (line.Wh != null)
  172. {
  173. info.WhID = line.Wh.ID;
  174. info.WhCode = line.Wh.Code;
  175. info.WhName = line.Wh.Name;
  176. }
  177. if (line.RcvLineLocations.Count > 0)
  178. {
  179. if (line.RcvLineLocations[0].Location != null)
  180. {
  181. info.BinID = line.RcvLineLocations[0].Location.ID;
  182. info.BinCode = line.RcvLineLocations[0].Location.Code;
  183. info.BinName = line.RcvLineLocations[0].Location.Name;
  184. }
  185. }
  186. }
  187. }
  188. private void FromMiscRcvTransL(BusinessEntity entity, WhBinInfo info)
  189. {
  190. if (entity is InvDoc.MiscRcv.MiscRcvTransL line)
  191. {
  192. if (line.Wh != null)
  193. {
  194. info.WhID = line.Wh.ID;
  195. info.WhCode = line.Wh.Code;
  196. info.WhName = line.Wh.Name;
  197. }
  198. if (line.MiscRcvTransBins.Count > 0)
  199. {
  200. if (line.MiscRcvTransBins[0].BinInfo != null && line.MiscRcvTransBins[0].BinInfo.Bin != null)
  201. {
  202. info.BinID = line.MiscRcvTransBins[0].BinInfo.Bin.ID;
  203. info.BinCode = line.MiscRcvTransBins[0].BinInfo.Bin.Code;
  204. info.BinName = line.MiscRcvTransBins[0].BinInfo.Bin.Name;
  205. }
  206. }
  207. }
  208. }
  209. private void FromTransInLine(BusinessEntity entity, WhBinInfo info)
  210. {
  211. if (entity is InvDoc.TransferIn.TransInLine line)
  212. {
  213. if (line.TransInWh != null)
  214. {
  215. info.WhID = line.TransInWh.ID;
  216. info.WhCode = line.TransInWh.Code;
  217. info.WhName = line.TransInWh.Name;
  218. }
  219. if (line.TransInBins.Count > 0)
  220. {
  221. if (line.TransInBins[0].BinInfo != null && line.TransInBins[0].BinInfo.Bin != null)
  222. {
  223. info.BinID = line.TransInBins[0].BinInfo.Bin.ID;
  224. info.BinCode = line.TransInBins[0].BinInfo.Bin.Code;
  225. info.BinName = line.TransInBins[0].BinInfo.Bin.Name;
  226. }
  227. }
  228. }
  229. }
  230. private void FromInventSheetLine(BusinessEntity entity, WhBinInfo info)
  231. {
  232. if (entity is InvDoc.InventorySheet.InventSheetLine line)
  233. {
  234. if (line.InventorySheet.Wh != null)
  235. {
  236. info.WhID = line.InventorySheet.Wh.ID;
  237. info.WhCode = line.InventorySheet.Wh.Code;
  238. info.WhName = line.InventorySheet.Wh.Name;
  239. }
  240. if (line.Bin != null && line.Bin.Bin != null)
  241. {
  242. info.BinID = line.Bin.Bin.ID;
  243. info.BinCode = line.Bin.Bin.Code;
  244. info.BinName = line.Bin.Bin.Name;
  245. }
  246. }
  247. }
  248. private void FromShipLine(BusinessEntity entity, WhBinInfo info)
  249. {
  250. if (entity is SM.Ship.ShipLine line)
  251. {
  252. if (line.WH != null)
  253. {
  254. info.WhID = line.WH.ID;
  255. info.WhCode = line.WH.Code;
  256. info.WhName = line.WH.Name;
  257. }
  258. if (line.ShipLineLocations.Count > 0)
  259. {
  260. if (line.ShipLineLocations[0].Location != null)
  261. {
  262. info.BinID = line.ShipLineLocations[0].Location.ID;
  263. info.BinCode = line.ShipLineLocations[0].Location.Code;
  264. info.BinName = line.ShipLineLocations[0].Location.Name;
  265. }
  266. }
  267. }
  268. }
  269. private void FromMiscShipmentL(BusinessEntity entity, WhBinInfo info)
  270. {
  271. if (entity is InvDoc.MiscShip.MiscShipmentL line)
  272. {
  273. if (line.Wh != null)
  274. {
  275. info.WhID = line.Wh.ID;
  276. info.WhCode = line.Wh.Code;
  277. info.WhName = line.Wh.Name;
  278. }
  279. if (line.MiscShipBins.Count > 0)
  280. {
  281. if (line.MiscShipBins[0].BinInfo != null && line.MiscShipBins[0].BinInfo.Bin != null)
  282. {
  283. info.BinID = line.MiscShipBins[0].BinInfo.Bin.ID;
  284. info.BinCode = line.MiscShipBins[0].BinInfo.Bin.Code;
  285. info.BinName = line.MiscShipBins[0].BinInfo.Bin.Name;
  286. }
  287. }
  288. }
  289. }
  290. private void FromIssueDocLine(BusinessEntity entity, WhBinInfo info)
  291. {
  292. if (entity is MO.Issue.IssueDocLine line)
  293. {
  294. if (line.Wh != null)
  295. {
  296. info.WhID = line.Wh.ID;
  297. info.WhCode = line.Wh.Code;
  298. info.WhName = line.Wh.Name;
  299. }
  300. if (line.Bin != null)
  301. {
  302. info.BinID = line.Bin.ID;
  303. info.BinCode = line.Bin.Code;
  304. info.BinName = line.Bin.Name;
  305. }
  306. }
  307. }
  308. private void FromIssueDocLineSum(BusinessEntity entity, WhBinInfo info)
  309. {
  310. if (entity is MO.Issue.IssueDocLineSum line)
  311. {
  312. if (line.Wh != null)
  313. {
  314. info.WhID = line.Wh.ID;
  315. info.WhCode = line.Wh.Code;
  316. info.WhName = line.Wh.Name;
  317. }
  318. if (line.Bin != null)
  319. {
  320. info.BinID = line.Bin.ID;
  321. info.BinCode = line.Bin.Code;
  322. info.BinName = line.Bin.Name;
  323. }
  324. }
  325. }
  326. private void FromWhInitLine(BusinessEntity entity, WhBinInfo info)
  327. {
  328. if (entity is InvDoc.WhInit.WhInitLine line)
  329. {
  330. if (line.Wh != null)
  331. {
  332. info.WhID = line.Wh.ID;
  333. info.WhCode = line.Wh.Code;
  334. info.WhName = line.Wh.Name;
  335. }
  336. if (line.WhInitLineBins.Count > 0)
  337. {
  338. if (line.WhInitLineBins[0].Bin != null && line.WhInitLineBins[0].Bin.Bin != null)
  339. {
  340. info.BinID = line.WhInitLineBins[0].Bin.Bin.ID;
  341. info.BinCode = line.WhInitLineBins[0].Bin.Bin.Code;
  342. info.BinName = line.WhInitLineBins[0].Bin.Bin.Name;
  343. }
  344. }
  345. }
  346. }
  347. }
  348. }