FrmProductOnTheWay.xml 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750
  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <Forms>
  3. <Form Name="FrmProductOnTheWay">
  4. <Client>
  5. <Events>
  6. <Load>
  7. <![CDATA[
  8. @Title="在途库存";
  9. GetSchema();
  10. ChangeMode("Search");
  11. dgProduct.NoMember="No_OnShipProduct";
  12. ]]>
  13. </Load>
  14. <Closing>
  15. ;
  16. </Closing>
  17. <Closed>
  18. ;
  19. </Closed>
  20. </Events>
  21. <Mode>
  22. <Search>
  23. <Lable name="Search" />
  24. </Search>
  25. <New>
  26. <Lable name="New" />
  27. </New>
  28. <View>
  29. <Lable name="View" />
  30. </View>
  31. <Modify>
  32. <Lable name="Modify" />
  33. </Modify>
  34. </Mode>
  35. <Controls>
  36. <IKTextButton name="tbNo" DataSource="OnShip.EncasementNo_OnShip">
  37. <Events>
  38. <Enter>
  39. <![CDATA[
  40. if(tbNo.ReadOnly == false)
  41. {
  42. if(tbNo.CValue != StringEmpty())
  43. {
  44. UpdateForm(false, "");
  45. if(Search("SearchOnShipWithNo", tbNo.CValue))
  46. {
  47. ChangeMode("View");
  48. }
  49. else
  50. {
  51. if(GetRight(@Title,"新增"))
  52. ChangeMode("New");
  53. else
  54. MessageBox("您没有新增在途库存的权限!",@Title);
  55. }
  56. }
  57. else
  58. {
  59. MessageBox("请输入装箱单号!",@Title);
  60. }
  61. }
  62. ]]>
  63. </Enter>
  64. <Click>
  65. @Temp = ShowSearchBox("OnShipSearch","NODEPOT","tbNo", tbNo.CValue);
  66. if(@Temp != StringEmpty())
  67. {
  68. tbNo.CValue = @Temp;
  69. UpdateForm(false, "");
  70. if(Search("SearchOnShipWithNo", tbNo.CValue))
  71. {
  72. ChangeMode("View");
  73. }
  74. }
  75. </Click>
  76. </Events>
  77. </IKTextButton>
  78. <IKDataTimePicker name="dtDelivery" DataSource="OnShip.DeliveryDate_OnShip" />
  79. <IKDataTimePicker name="dtArrival" DataSource="OnShip.ArrivalDate_OnShip" />
  80. <IKTextBox name="txtInvoiceNo" DataSource="OnShip.InvoiceNo_OnShip"/>
  81. <IKDataGridEx name="dgProduct" DataSource="OnShipProduct" TableStyleIndex="0">
  82. <DataColumn Index="0" DataSource="OnShipProduct.No_OnShipProduct" />
  83. <DataColumn Index="1" DataSource="OnShipProduct.No_FromBill" />
  84. <DataColumn Index="2" DataSource="OnShipProduct.No_FromBillProduct" />
  85. <DataColumn Index="3" DataSource="OnShipProduct.No_Product" />
  86. <DataColumn Index="4" DataSource="OnShipProduct.Name_Product" />
  87. <DataColumn Index="5" DataSource="OnShipProduct.Quantity_OnShipProduct" />
  88. <DataColumn Index="6" DataSource="OnShipProduct.Quantity_Order" />
  89. <DataColumn Index="7" DataSource="OnShipProduct.Quantity_InDepotBillProduct" />
  90. <DataColumn Index="8" DataSource="OnShipProduct.Quantity_EndCase" />
  91. <DataColumn Index="9" DataSource="OnShipProduct.Quantity_OnShip" />
  92. </IKDataGridEx>
  93. <IKFormToolBar name="toolBar">
  94. <Events>
  95. <ClickFirst>
  96. <!--if(CreateThread("Search","SearchOnShipFirst", tbNo.CValue))
  97. {
  98. ChangeMode("View");
  99. }
  100. MessageBox("thread ok");-->
  101. if(Search("SearchOnShipFirst"))
  102. {
  103. ChangeMode("View");
  104. }
  105. </ClickFirst>
  106. <ClickPrev>
  107. if(Search("SearchOnShipPrevious", tbNo.CValue))
  108. {
  109. ChangeMode("View");
  110. }
  111. </ClickPrev>
  112. <ClickNext>
  113. if(Search("SearchOnShipNext", tbNo.CValue))
  114. {
  115. ChangeMode("View");
  116. }
  117. </ClickNext>
  118. <ClickLast>
  119. if(Search("SearchOnShipLast"))
  120. {
  121. ChangeMode("View");
  122. }
  123. </ClickLast>
  124. <ClickNew>
  125. ;
  126. </ClickNew>
  127. <ClickEmpty>
  128. ChangeMode("Search");
  129. </ClickEmpty>
  130. <ClickSubmit>
  131. <Lable name="SubmitButtonClick" />
  132. </ClickSubmit>
  133. <ClickModify>
  134. ChangeMode("Modify");
  135. </ClickModify>
  136. <ClickDelete>
  137. Delete(); ChangeMode("Search");
  138. </ClickDelete>
  139. <ClickPrint>
  140. PrintReport();
  141. </ClickPrint>
  142. <ClickAudit>
  143. ;
  144. </ClickAudit>
  145. <ClickUnAudit>
  146. ;
  147. </ClickUnAudit>
  148. <ClickImport>
  149. ;
  150. </ClickImport>
  151. <ClickExport>
  152. ;
  153. </ClickExport>
  154. <ClickClose>
  155. ;
  156. </ClickClose>
  157. <ClickExpand>
  158. if(toolBar.ExpandForm==true)
  159. {
  160. pnRight.Visible=true;<!--PanelRight is not existed-->
  161. }
  162. else
  163. {
  164. pnRight.Visible=false;
  165. }
  166. </ClickExpand>
  167. <ClickImportItem>
  168. <![CDATA[
  169. if((@Status == 1 || @Status == 3) && toolBar.MenuItemText=="采购订单")
  170. {
  171. if(Search("SearchContr"))
  172. {
  173. ShowSearchBox("ImportPurchaseOrderBillControl","BILLCONVERT","#OnShipProduct.No_FromBill","采购订单");
  174. }
  175. else
  176. {
  177. ShowSearchBox("ImportPurchaseOrderBillUnControl","BILLCONVERT");
  178. }
  179. }
  180. ]]>
  181. <!--使用前先访问ToolBar的MenuItemText属性以确定选中的是那一项-->
  182. </ClickImportItem>
  183. </Events>
  184. </IKFormToolBar>
  185. </Controls>
  186. <Tables>
  187. <Table name="OnShipProduct">
  188. <Events>
  189. <ColumnsChanged>
  190. <No_FromBill>
  191. if(!Equals(#OnShipProduct.No_FromBill,"")&amp;&amp;!Equals(#OnShipProduct.No_FromBillProduct,""))
  192. {
  193. if(Search("SearchPurchaseOrderBillProduct",#OnShipProduct.No_FromBill,#OnShipProduct.No_FromBillProduct))
  194. {
  195. #OnShipProduct.ID_Product=#PurchaseOrderBillProduct.ID_Product;
  196. #OnShipProduct.ID_PurchaseSourceBillProduct=#PurchaseOrderBillProduct.ID_PurchaseSourceBillProduct;
  197. #OnShipProduct.No_Product=#PurchaseOrderBillProduct.No_Product;
  198. #OnShipProduct.Name_Product=#PurchaseOrderBillProduct.Name_Product;
  199. #OnShipProduct.Quantity_OnShipProduct=#PurchaseOrderBillProduct.Quantity_Order-#PurchaseOrderBillProduct.Quantity_InDepot-#PurchaseOrderBillProduct.Quantity_EndCase-#PurchaseOrderBillProduct.Quantity_OnShip;
  200. #OnShipProduct.Quantity_Order=#PurchaseOrderBillProduct.Quantity_Order;
  201. #OnShipProduct.Quantity_InDepotBillProduct=#PurchaseOrderBillProduct.Quantity_InDepot;
  202. #OnShipProduct.Quantity_EndCase=#PurchaseOrderBillProduct.Quantity_EndCase;
  203. #OnShipProduct.Quantity_OnShip=#PurchaseOrderBillProduct.Quantity_OnShip;
  204. }
  205. else
  206. {
  207. #OnShipProduct.ID_Product=GuidEmpty();
  208. #OnShipProduct.ID_PurchaseSourceBillProduct=GuidEmpty();
  209. #OnShipProduct.No_Product="";
  210. #OnShipProduct.Name_Product="";
  211. #OnShipProduct.Quantity_OnShipProduct=0;
  212. #OnShipProduct.Quantity_Order=0;
  213. #OnShipProduct.Quantity_InDepotBillProduct=0;
  214. #OnShipProduct.Quantity_EndCase=0;
  215. #OnShipProduct.Quantity_OnShip=0;
  216. }
  217. }
  218. </No_FromBill>
  219. <No_FromBillProduct>
  220. if(!Equals(#OnShipProduct.No_FromBill,"")&amp;&amp;!Equals(#OnShipProduct.No_FromBillProduct,""))
  221. {
  222. if(Search("SearchPurchaseOrderBillProduct",#OnShipProduct.No_FromBill,#OnShipProduct.No_FromBillProduct))
  223. {
  224. #OnShipProduct.ID_Product=#PurchaseOrderBillProduct.ID_Product;
  225. #OnShipProduct.ID_PurchaseSourceBillProduct=#PurchaseOrderBillProduct.ID_PurchaseSourceBillProduct;
  226. #OnShipProduct.No_Product=#PurchaseOrderBillProduct.No_Product;
  227. #OnShipProduct.Name_Product=#PurchaseOrderBillProduct.Name_Product;
  228. #OnShipProduct.Quantity_OnShipProduct=#PurchaseOrderBillProduct.Quantity_Order-#PurchaseOrderBillProduct.Quantity_InDepot-#PurchaseOrderBillProduct.Quantity_EndCase-#PurchaseOrderBillProduct.Quantity_OnShip;
  229. #OnShipProduct.Quantity_Order=#PurchaseOrderBillProduct.Quantity_Order;
  230. #OnShipProduct.Quantity_InDepotBillProduct=#PurchaseOrderBillProduct.Quantity_InDepot;
  231. #OnShipProduct.Quantity_EndCase=#PurchaseOrderBillProduct.Quantity_EndCase;
  232. #OnShipProduct.Quantity_OnShip=#PurchaseOrderBillProduct.Quantity_OnShip;
  233. }
  234. else
  235. {
  236. #OnShipProduct.ID_Product=GuidEmpty();
  237. #OnShipProduct.ID_PurchaseSourceBillProduct=GuidEmpty();
  238. #OnShipProduct.No_Product="";
  239. #OnShipProduct.Name_Product="";
  240. #OnShipProduct.Quantity_OnShipProduct=0;
  241. #OnShipProduct.Quantity_Order=0;
  242. #OnShipProduct.Quantity_InDepotBillProduct=0;
  243. #OnShipProduct.Quantity_EndCase=0;
  244. #OnShipProduct.Quantity_OnShip=0;
  245. }
  246. }
  247. </No_FromBillProduct>
  248. </ColumnsChanged>
  249. </Events>
  250. </Table>
  251. </Tables>
  252. <LockInfomation LockID="ID_OnShip" LockNO="EncasementNo_OnShip" LockSearchFunction="SearchOnShipWithNo"/>
  253. <ChildForms>
  254. <ChildForm name="OnShipSearch" DataSource="OnShip" SearchFunction="SearchAllOnShip" SearchFunctionByNo="SearchOnShipWithNo" MappingName="装箱单号">
  255. <DataColumn Index="0" MappingName="#OnShip.EncasementNo_OnShip" HeaderText="装箱单号" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  256. <DataColumn Index="1" MappingName="#OnShip.DeliveryDate_OnShip" HeaderText="发货日期" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  257. </ChildForm>
  258. <ChildForm name="ImportPurchaseOrderBillControl" >
  259. <DataGridIndex DataSource="PurchaseOrderBill" SearchFunction="SearchAllPurchaseOrderBill" SearchFunctionByNo="" MappingName="" ReturnDataSource="OnShipProduct">
  260. <DataColumn Index="0" MappingName="#PurchaseOrderBill.No_PurchaseOrderBill" HeaderText="单据编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" ReturnMappingName="#OnShipProduct.No_FromBill"/>
  261. <DataColumn Index="1" MappingName="#PurchaseOrderBill.Date_PurchaseOrderBill" HeaderText="制单日期" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
  262. <DataColumn Index="2" MappingName="#PurchaseOrderBill.No_Supplier" HeaderText="供应商编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent"/>
  263. <DataColumn Index="3" MappingName="#PurchaseOrderBill.ShortName_Customer" HeaderText="供应商简称" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
  264. <DataColumn Index="4" MappingName="#PurchaseOrderBill.State_PurchaseOrderBill" HeaderText="单据状态" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
  265. <DataColumn Index="5" MappingName="#PurchaseOrderBill.Name_Location" HeaderText="到货仓库" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent" />
  266. </DataGridIndex>
  267. <DataGridIndex DataSource="PurchaseOrderBillProduct" SearchFunction="SearchAllPurchaseOrderBillProduct" SearchFunctionByNo="" MappingName="">
  268. <DataColumn Index="0" MappingName="#PurchaseOrderBillProduct.No_Product" HeaderText="产品编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
  269. <DataColumn Index="1" MappingName="#PurchaseOrderBillProduct.No_PurchaseOrderBillProduct" HeaderText="产品序号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" ReturnMappingName="#OnShipProduct.No_FromBillProduct"/>
  270. <DataColumn Index="2" MappingName="#PurchaseOrderBillProduct.Name_Product" HeaderText="产品名称" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
  271. <DataColumn Index="3" MappingName="#PurchaseOrderBillProduct.Quantity_PurchaseOrderBillProduct" HeaderText="数量" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" Format="F2"/>
  272. </DataGridIndex>
  273. </ChildForm>
  274. <ChildForm name="ImportPurchaseOrderBillUnControl" >
  275. <DataGridIndex DataSource="PurchaseOrderBill" SearchFunction="SearchAllPurchaseOrderBill" SearchFunctionByNo="" MappingName="" ReturnDataSource="OnShipProduct">
  276. <DataColumn Index="0" MappingName="#PurchaseOrderBill.No_PurchaseOrderBill" HeaderText="单据编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" ReturnMappingName="#OnShipProduct.No_FromBill"/>
  277. <DataColumn Index="1" MappingName="#PurchaseOrderBill.Date_PurchaseOrderBill" HeaderText="制单日期" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
  278. <DataColumn Index="2" MappingName="#PurchaseOrderBill.No_Supplier" HeaderText="供应商编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent"/>
  279. <DataColumn Index="3" MappingName="#PurchaseOrderBill.ShortName_Customer" HeaderText="供应商简称" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
  280. <DataColumn Index="4" MappingName="#PurchaseOrderBill.State_PurchaseOrderBill" HeaderText="单据状态" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
  281. <DataColumn Index="5" MappingName="#PurchaseOrderBill.Name_Location" HeaderText="到货仓库" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="parent" />
  282. </DataGridIndex>
  283. <DataGridIndex DataSource="PurchaseOrderBillProduct" SearchFunction="SearchAllPurchaseOrderBillProduct" SearchFunctionByNo="" MappingName="">
  284. <DataColumn Index="0" MappingName="#PurchaseOrderBillProduct.No_Product" HeaderText="产品编号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
  285. <DataColumn Index="1" MappingName="#PurchaseOrderBillProduct.No_PurchaseOrderBillProduct" HeaderText="产品序号" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" ReturnMappingName="#OnShipProduct.No_FromBillProduct"/>
  286. <DataColumn Index="2" MappingName="#PurchaseOrderBillProduct.Name_Product" HeaderText="产品名称" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child"/>
  287. <DataColumn Index="3" MappingName="#PurchaseOrderBillProduct.Quantity_PurchaseOrderBillProduct" HeaderText="数量" Width="90" ColumnType="IKDataGridTextBoxColumn" ReturnPath="child" Format="F2"/>
  288. </DataGridIndex>
  289. </ChildForm>
  290. </ChildForms>
  291. </Client>
  292. <Server>
  293. <Tables>
  294. <Table name="OnShip" Type="Parent">
  295. <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 * FROM OnShip "/>
  296. <New CmdType="Text" CmdText=" INSERT INTO OnShip(ID_OnShip,EncasementNo_OnShip,DeliveryDate_OnShip,InvoiceNo_OnShip,ArrivalDate_OnShip)
  297. VALUES(@ID_OnShip,@EncasementNo_OnShip,@DeliveryDate_OnShip,@InvoiceNo_OnShip,@ArrivalDate_OnShip)" >
  298. <Params>
  299. <Param name="@ID_OnShip" type="OnShip.ID_OnShip" sourceColumn="ID_OnShip" />
  300. <Param name="@EncasementNo_OnShip" type="OnShip.EncasementNo_OnShip" sourceColumn="EncasementNo_OnShip" />
  301. <Param name="@DeliveryDate_OnShip" type="OnShip.DeliveryDate_OnShip" sourceColumn="DeliveryDate_OnShip" />
  302. <Param name="@InvoiceNo_OnShip" type="OnShip.InvoiceNo_OnShip" sourceColumn="InvoiceNo_OnShip" />
  303. <Param name="@ArrivalDate_OnShip" type="OnShip.ArrivalDate_OnShip" sourceColumn="ArrivalDate_OnShip" />
  304. </Params>
  305. </New>
  306. <Update CmdType="Text" CmdText="UPDATE OnShip SET EncasementNo_OnShip=@EncasementNo_OnShip,DeliveryDate_OnShip=@DeliveryDate_OnShip,InvoiceNo_OnShip=@InvoiceNo_OnShip,ArrivalDate_OnShip=@ArrivalDate_OnShip
  307. WHERE ID_OnShip=@ID_OnShip">
  308. <Params>
  309. <Param name="@ID_OnShip" type="OnShip.ID_OnShip" sourceColumn="ID_OnShip" />
  310. <Param name="@EncasementNo_OnShip" type="OnShip.EncasementNo_OnShip" sourceColumn="EncasementNo_OnShip" />
  311. <Param name="@DeliveryDate_OnShip" type="OnShip.DeliveryDate_OnShip" sourceColumn="DeliveryDate_OnShip" />
  312. <Param name="@InvoiceNo_OnShip" type="OnShip.InvoiceNo_OnShip" sourceColumn="InvoiceNo_OnShip" />
  313. <Param name="@ArrivalDate_OnShip" type="OnShip.ArrivalDate_OnShip" sourceColumn="ArrivalDate_OnShip" />
  314. </Params>
  315. </Update>
  316. <Delete CmdType="Text" CmdText="
  317. DECLARE @ID_PurchaseSourceBillProduct UNIQUEIDENTIFIER
  318. DECLARE @Quantity_OnShipProduct DECIMAL(14,4)
  319. DECLARE cur CURSOR FOR SELECT ID_PurchaseSourceBillProduct,Quantity_OnShipProduct
  320. FROM OnShipProduct WHERE ID_OnShip=@ID_OnShip
  321. OPEN cur
  322. FETCH NEXT FROM cur INTO @ID_PurchaseSourceBillProduct,@Quantity_OnShipProduct
  323. WHILE @@FETCH_STATUS=0
  324. BEGIN
  325. UPDATE PurchaseSourceBillProduct SET Quantity_OnShip=Quantity_OnShip-@Quantity_OnShipProduct WHERE ID_PurchaseSourceBillProduct=@ID_PurchaseSourceBillProduct
  326. FETCH NEXT FROM cur INTO @ID_PurchaseSourceBillProduct,@Quantity_OnShipProduct
  327. END
  328. DELETE FROM OnShipProduct WHERE ID_OnShip=@ID_OnShip
  329. DELETE FROM OnShip WHERE ID_OnShip=@ID_OnShip">
  330. <Params>
  331. <Param name="@ID_OnShip" type="OnShip.ID_OnShip" sourceColumn="ID_OnShip" />
  332. </Params>
  333. </Delete>
  334. <FKErrorReport ErrorMessage="该装箱单号已被引用,删除失败!"/>
  335. <UNIQUEErrorReport ErrorMessage="该发票号码已存在,提交失败!"/>
  336. </Table>
  337. <Table name="OnShipProduct" Type="Child">
  338. <GetSchema CmdType="Text" CmdText="
  339. SELECT TOP 0 OnShipProduct.*,Product.No_Product,Product.Name_Product
  340. FROM OnShipProduct
  341. LEFT JOIN Product On Product.ID_Product=OnShipProduct.ID_Product" />
  342. <New CmdType="Text" CmdText="
  343. DECLARE @Error NVARCHAR(256)
  344. IF(@Quantity_OnShipProduct &gt; (SELECT (Quantity_Order-Quantity_InDepot-Quantity_OnShip-Quantity_EndCase)
  345. FROM PurchaseSourceBillProduct WHERE ID_PurchaseSourceBillProduct=@ID_PurchaseSourceBillProduct))
  346. BEGIN
  347. SET @Error='采购订单编号为'+@No_FromBill+'序号为'+@No_FromBillProduct+'的本次在途数量 &gt; 订货数量-已入库数量-强制结案数量-(本订单产品)已在途数量,提交失败!'
  348. RAISERROR(@Error,16,1)
  349. RETURN
  350. END
  351. INSERT INTO OnShipProduct(ID_OnShipProduct,No_OnShipProduct,ID_OnShip,ID_PurchaseSourceBillProduct,No_FromBill,No_FromBillProduct,ID_Product,Quantity_Order,Quantity_OnShipProduct,Quantity_InDepotBillProduct,Quantity_OnShip,Quantity_EndCase)
  352. VALUES(@ID_OnShipProduct,@No_OnShipProduct,@ID_OnShip,@ID_PurchaseSourceBillProduct,@No_FromBill,@No_FromBillProduct,@ID_Product,@Quantity_Order,@Quantity_OnShipProduct,@Quantity_InDepotBillProduct,@Quantity_OnShip,@Quantity_EndCase)
  353. UPDATE PurchaseSourceBillProduct SET Quantity_OnShip=Quantity_OnShip+@Quantity_OnShipProduct
  354. WHERE ID_PurchaseSourceBillProduct=@ID_PurchaseSourceBillProduct
  355. ">
  356. <Params>
  357. <Param name="@ID_OnShipProduct" type="OnShipProduct.ID_OnShipProduct" sourceColumn="ID_OnShipProduct" />
  358. <Param name="@No_OnShipProduct" type="OnShipProduct.No_OnShipProduct" sourceColumn="No_OnShipProduct" />
  359. <Param name="@ID_OnShip" type="OnShipProduct.ID_OnShip" sourceColumn="ID_OnShip" />
  360. <Param name="@ID_PurchaseSourceBillProduct" type="OnShipProduct.ID_PurchaseSourceBillProduct" sourceColumn="ID_PurchaseSourceBillProduct" />
  361. <Param name="@No_FromBill" type="OnShipProduct.No_FromBill" sourceColumn="No_FromBill" />
  362. <Param name="@No_FromBillProduct" type="OnShipProduct.No_FromBillProduct" sourceColumn="No_FromBillProduct" />
  363. <Param name="@ID_Product" type="OnShipProduct.ID_Product" sourceColumn="ID_Product" />
  364. <Param name="@Quantity_Order" type="OnShipProduct.Quantity_Order" sourceColumn="Quantity_Order" />
  365. <Param name="@Quantity_OnShipProduct" type="OnShipProduct.Quantity_OnShipProduct" sourceColumn="Quantity_OnShipProduct" />
  366. <Param name="@Quantity_InDepotBillProduct" type="OnShipProduct.Quantity_InDepotBillProduct" sourceColumn="Quantity_InDepotBillProduct" />
  367. <Param name="@Quantity_OnShip" type="OnShipProduct.Quantity_OnShip" sourceColumn="Quantity_OnShip" />
  368. <Param name="@Quantity_EndCase" type="OnShipProduct.Quantity_EndCase" sourceColumn="Quantity_EndCase" />
  369. </Params>
  370. </New>
  371. <Update CmdType="Text" CmdText="
  372. DECLARE @oldValue decimal(14,4)
  373. DECLARE @Error NVARCHAR(256)
  374. SELECT @oldValue=Quantity_OnShipProduct From OnShipProduct Where ID_OnShipProduct=@ID_OnShipProduct
  375. IF((@Quantity_OnShipProduct-@oldValue) &gt; (SELECT (Quantity_Order-Quantity_InDepot-Quantity_OnShip-Quantity_EndCase)
  376. FROM PurchaseSourceBillProduct WHERE ID_PurchaseSourceBillProduct=@ID_PurchaseSourceBillProduct))
  377. BEGIN
  378. SET @Error='采购订单编号为'+@No_FromBill+'序号为'+@No_FromBillProduct+'的本次在途数量 &gt; 订货数量-已入库数量-强制结案数量-(本订单产品)已在途数量,提交失败!'
  379. RAISERROR(@Error,16,1)
  380. RETURN
  381. END
  382. UPDATE OnShipProduct
  383. SET No_OnShipProduct=@No_OnShipProduct,ID_OnShip=@ID_OnShip,ID_PurchaseSourceBillProduct=@ID_PurchaseSourceBillProduct,No_FromBill=@No_FromBill,No_FromBillProduct=@No_FromBillProduct,
  384. ID_Product=@ID_Product,Quantity_Order=@Quantity_Order,Quantity_OnShipProduct=@Quantity_OnShipProduct,Quantity_InDepotBillProduct=@Quantity_InDepotBillProduct,Quantity_OnShip=@Quantity_OnShip,Quantity_EndCase=@Quantity_EndCase
  385. WHERE ID_OnShipProduct=@ID_OnShipProduct
  386. UPDATE PurchaseSourceBillProduct SET Quantity_OnShip=Quantity_OnShip+@Quantity_OnShipProduct-@oldValue
  387. WHERE ID_PurchaseSourceBillProduct=@ID_PurchaseSourceBillProduct
  388. ">
  389. <Params>
  390. <Param name="@ID_OnShipProduct" type="OnShipProduct.ID_OnShipProduct" sourceColumn="ID_OnShipProduct" />
  391. <Param name="@No_OnShipProduct" type="OnShipProduct.No_OnShipProduct" sourceColumn="No_OnShipProduct" />
  392. <Param name="@ID_OnShip" type="OnShipProduct.ID_OnShip" sourceColumn="ID_OnShip" />
  393. <Param name="@ID_PurchaseSourceBillProduct" type="OnShipProduct.ID_PurchaseSourceBillProduct" sourceColumn="ID_PurchaseSourceBillProduct" />
  394. <Param name="@No_FromBill" type="OnShipProduct.No_FromBill" sourceColumn="No_FromBill" />
  395. <Param name="@No_FromBillProduct" type="OnShipProduct.No_FromBillProduct" sourceColumn="No_FromBillProduct" />
  396. <Param name="@ID_Product" type="OnShipProduct.ID_Product" sourceColumn="ID_Product" />
  397. <Param name="@Quantity_Order" type="OnShipProduct.Quantity_Order" sourceColumn="Quantity_Order" />
  398. <Param name="@Quantity_OnShipProduct" type="OnShipProduct.Quantity_OnShipProduct" sourceColumn="Quantity_OnShipProduct" />
  399. <Param name="@Quantity_InDepotBillProduct" type="OnShipProduct.Quantity_InDepotBillProduct" sourceColumn="Quantity_InDepotBillProduct" />
  400. <Param name="@Quantity_OnShip" type="OnShipProduct.Quantity_OnShip" sourceColumn="Quantity_OnShip" />
  401. <Param name="@Quantity_EndCase" type="OnShipProduct.Quantity_EndCase" sourceColumn="Quantity_EndCase" />
  402. </Params>
  403. </Update>
  404. <Delete CmdType="Text" CmdText="
  405. UPDATE PurchaseSourceBillProduct
  406. SET Quantity_OnShip=Quantity_OnShip-@Quantity_OnShipProduct
  407. WHERE ID_PurchaseSourceBillProduct=@ID_PurchaseSourceBillProduct
  408. DELETE FROM OnShipProduct WHERE ID_OnShipProduct=@ID_OnShipProduct
  409. ">
  410. <Params>
  411. <Param name="@ID_OnShipProduct" type="OnShipProduct.ID_OnShipProduct" sourceColumn="ID_OnShipProduct" />
  412. <Param name="@ID_PurchaseSourceBillProduct" type="OnShipProduct.ID_PurchaseSourceBillProduct" sourceColumn="ID_PurchaseSourceBillProduct" />
  413. <Param name="@Quantity_OnShipProduct" type="OnShipProduct.Quantity_OnShipProduct" sourceColumn="Quantity_OnShipProduct" />
  414. </Params>
  415. </Delete>
  416. </Table>
  417. </Tables>
  418. <Search>
  419. <SearchAllOnShip CmdType="Text" CmdText="SELECT EncasementNo_OnShip,DeliveryDate_OnShip FROM OnShip ">
  420. <Tables>
  421. <Table name="AllOnShip" />
  422. </Tables>
  423. </SearchAllOnShip>
  424. <SearchOnShipWithNo CmdType="Text" CmdText=" DECLARE @ID_OnShip uniqueidentifier
  425. SELECT * FROM OnShip
  426. where EncasementNo_OnShip = @EncasementNo_OnShip
  427. SELECT @ID_OnShip = ID_OnShip FROM OnShip where EncasementNo_OnShip = @EncasementNo_OnShip
  428. SELECT OnShipProduct.*,Product.No_Product,Product.Name_Product
  429. FROM OnShipProduct
  430. JOIN Product On Product.ID_Product=OnShipProduct.ID_Product
  431. WHERE ID_OnShip=@ID_OnShip
  432. Order By No_OnShipProduct
  433. ">
  434. <Params>
  435. <Param name="@EncasementNo_OnShip" type="OnShip.EncasementNo_OnShip" Index="0" />
  436. </Params>
  437. <Tables>
  438. <Table name="OnShip" />
  439. <Table name="OnShipProduct" />
  440. </Tables>
  441. </SearchOnShipWithNo>
  442. <SearchPurchaseOrderBillProduct CmdType="Text" CmdText="
  443. SELECT PurchaseSourceBillProduct.*,Product.No_Product,Product.Name_Product,Product.ID_Product
  444. FROM PurchaseOrderBillProduct
  445. Left Join PurchaseSourceBillProduct ON PurchaseOrderBillProduct.ID_PurchaseOrderBillProduct=PurchaseSourceBillProduct.ID_PurchaseSourceBillProduct
  446. Join PurchaseOrderBill On PurchaseOrderBill.ID_PurchaseOrderBill=PurchaseOrderBillProduct.ID_PurchaseOrderBill
  447. Join Product ON Product.ID_Product=PurchaseOrderBillProduct.ID_Product
  448. WHERE PurchaseOrderBill.ID_Assessor Is Not Null And No_PurchaseOrderBill=@No_PurchaseOrderBill AND No_PurchaseOrderBillProduct=@No_PurchaseOrderBillProduct
  449. ">
  450. <Params>
  451. <Param name="@No_PurchaseOrderBill" type="PurchaseOrderBill.No_PurchaseOrderBill" Index="0" />
  452. <Param name="@No_PurchaseOrderBillProduct" type="PurchaseOrderBillProduct.No_PurchaseOrderBillProduct" Index="1" />
  453. </Params>
  454. <Tables>
  455. <Table name="PurchaseOrderBillProduct" />
  456. </Tables>
  457. </SearchPurchaseOrderBillProduct>
  458. <SearchPurchaseOrderBill CmdType="Text" CmdText="
  459. Select ID_Assessor From PurchaseOrderBill
  460. Where No_PurchaseOrderBill=@No_PurchaseOrderBill
  461. ">
  462. <Params>
  463. <Param name="@No_PurchaseOrderBill" type="PurchaseOrderBill.No_PurchaseOrderBill" Index="0" />
  464. </Params>
  465. <Tables>
  466. <Table name="PurchaseOrderBill" />
  467. </Tables>
  468. </SearchPurchaseOrderBill>
  469. <SearchOnShipFirst CmdType="Text" CmdText=" DECLARE @ID_OnShip UNIQUEIDENTIFIER
  470. SELECT TOP 1 @ID_OnShip=ID_OnShip FROM OnShip ORDER BY EncasementNo_OnShip
  471. SELECT * FROM OnShip WHERE ID_OnShip=@ID_OnShip
  472. SELECT OnShipProduct.*,Product.No_Product,Product.Name_Product
  473. FROM OnShipProduct JOIN Product ON Product.ID_Product=OnShipProduct.ID_Product
  474. WHERE ID_OnShip=@ID_OnShip
  475. Order By No_OnShipProduct">
  476. <Tables>
  477. <Table name="OnShip" />
  478. <Table name="OnShipProduct" />
  479. </Tables>
  480. </SearchOnShipFirst>
  481. <SearchOnShipPrevious CmdType="Text" CmdText=" DECLARE @ID_OnShip UNIQUEIDENTIFIER
  482. SELECT TOP 1 @ID_OnShip=ID_OnShip FROM OnShip WHERE EncasementNo_OnShip &lt; @EncasementNo_OnShip ORDER BY EncasementNo_OnShip DESC
  483. SELECT * FROM OnShip WHERE ID_OnShip=@ID_OnShip
  484. SELECT OnShipProduct.*,Product.No_Product,Product.Name_Product
  485. FROM OnShipProduct JOIN Product ON Product.ID_Product=OnShipProduct.ID_Product
  486. WHERE ID_OnShip=@ID_OnShip
  487. Order By No_OnShipProduct
  488. ">
  489. <Params>
  490. <Param name="@EncasementNo_OnShip" type="OnShip.EncasementNo_OnShip" Index="0" />
  491. </Params>
  492. <Tables>
  493. <Table name="OnShip" />
  494. <Table name="OnShipProduct" />
  495. </Tables>
  496. </SearchOnShipPrevious>
  497. <SearchOnShipNext CmdType="Text" CmdText=" DECLARE @ID_OnShip UNIQUEIDENTIFIER
  498. SELECT TOP 1 @ID_OnShip=ID_OnShip FROM OnShip WHERE EncasementNo_OnShip &gt; @EncasementNo_OnShip ORDER BY EncasementNo_OnShip
  499. SELECT * FROM OnShip WHERE ID_OnShip=@ID_OnShip
  500. SELECT OnShipProduct.*,Product.No_Product,Product.Name_Product
  501. FROM OnShipProduct JOIN Product ON Product.ID_Product=OnShipProduct.ID_Product
  502. WHERE ID_OnShip=@ID_OnShip
  503. Order By No_OnShipProduct
  504. ">
  505. <Params>
  506. <Param name="@EncasementNo_OnShip" type="OnShip.EncasementNo_OnShip" Index="0" />
  507. </Params>
  508. <Tables>
  509. <Table name="OnShip" />
  510. <Table name="OnShipProduct" />
  511. </Tables>
  512. </SearchOnShipNext>
  513. <SearchOnShipLast CmdType="Text" CmdText=" DECLARE @ID_OnShip UNIQUEIDENTIFIER
  514. SELECT TOP 1 @ID_OnShip=ID_OnShip FROM OnShip ORDER BY EncasementNo_OnShip DESC
  515. SELECT * FROM OnShip WHERE ID_OnShip=@ID_OnShip
  516. SELECT OnShipProduct.*,Product.No_Product,Product.Name_Product
  517. FROM OnShipProduct JOIN Product ON Product.ID_Product=OnShipProduct.ID_Product
  518. WHERE ID_OnShip=@ID_OnShip
  519. Order By No_OnShipProduct
  520. ">
  521. <Tables>
  522. <Table name="OnShip" />
  523. <Table name="OnShipProduct" />
  524. </Tables>
  525. </SearchOnShipLast>
  526. <SearchContr CmdType="Text" CmdText=" SELECT SystemSetting.StockAndInDepot_SystemSetting FROM SystemSetting WHERE SystemSetting.StockAndInDepot_SystemSetting = 1">
  527. <Tables>
  528. <Table name="SystemOutIn" />
  529. </Tables>
  530. </SearchContr>
  531. <SearchAllPurchaseOrderBill CmdType="Text" CmdText="Select PurchaseOrderBill.ID_PurchaseOrderBill,PurchaseOrderBill.No_PurchaseOrderBill,PurchaseOrderBill.Date_PurchaseOrderBill,Supplier.No_Supplier,Supplier.ShortName_Supplier,Case When PurchaseOrderBill.ID_Assessor is null Then '未审核' Else '已审核' End As State_PurchaseOrderBill,Location.Name_Location From PurchaseOrderBill
  532. Inner Join Supplier On PurchaseOrderBill.ID_Supplier = Supplier.ID_Supplier
  533. Inner Join Location On Location.ID_Location = PurchaseOrderBill.ID_Location" >
  534. <Tables>
  535. <Table name="AllSaleOutDepotBill" />
  536. </Tables>
  537. </SearchAllPurchaseOrderBill>
  538. <SearchAllPurchaseOrderBillProduct CmdType="Text" CmdText="Select Product.No_Product,PurchaseOrderBillProduct.No_PurchaseOrderBillProduct,Product.Name_Product,PurchaseOrderBillProduct.Quantity_PurchaseOrderBillProduct,PurchaseOrderBillProduct.UnitPrice_PurchaseOrderBillProduct From PurchaseOrderBillProduct
  539. Inner Join Product On Product.ID_Product = PurchaseOrderBillProduct.ID_Product
  540. Inner Join PurchaseOrderBill On PurchaseOrderBill.ID_PurchaseOrderBill = PurchaseOrderBillProduct.ID_PurchaseOrderBill" >
  541. <Tables>
  542. <Table name="AllSaleOutDepotBillProduct" />
  543. </Tables>
  544. </SearchAllPurchaseOrderBillProduct>
  545. <SearchSupplier CmdType="Text" CmdText="Select No_Supplier From PurchaseOrderBill
  546. Inner Join Supplier On Supplier.ID_Supplier = PurchaseOrderBill.ID_Supplier
  547. Where No_PurchaseOrderBill = @No_PurchaseOrderBill">
  548. <Params>
  549. <Param name="@No_PurchaseOrderBill" type="PurchaseOrderBill.No_PurchaseOrderBill" Index="0" />
  550. </Params>
  551. <Tables>
  552. <Table name="Supplier" />
  553. </Tables>
  554. </SearchSupplier>
  555. </Search>
  556. </Server>
  557. <Lables>
  558. <Search>
  559. Empty();
  560. NewInstance();
  561. tbNo.ReadOnly=false;
  562. dtArrival.Enabled=false;
  563. txtInvoiceNo.ReadOnly=true;
  564. dgProduct.ReadOnly=true;
  565. toolBar.EnableSubmit=false;
  566. toolBar.EnableModify=false;
  567. toolBar.EnableDelete=false;
  568. toolBar.EnablePrint=false;
  569. toolBar.EnableImport= false;
  570. UpdateForm(true, "");
  571. tbNo.Focus();
  572. @Status=0;
  573. </Search>
  574. <New>
  575. Empty();
  576. NewInstance();
  577. tbNo.ReadOnly=true;
  578. dtArrival.Enabled=true;
  579. txtInvoiceNo.ReadOnly=false;
  580. dgProduct.ReadOnly=false;
  581. dgProduct.SetColumnReadOnly(1, false);
  582. dgProduct.SetColumnReadOnly(2, false);
  583. dgProduct.AllowNew(true);
  584. #OnShip.EncasementNo_OnShip=tbNo.CValue;
  585. #OnShip.ID_OnShip=NewGuid();
  586. toolBar.EnableSubmit=GetRight(@Title,"新增");
  587. toolBar.EnableModify=false;
  588. toolBar.EnableDelete=false;
  589. toolBar.EnablePrint=false;
  590. toolBar.EnableImport= true;
  591. UpdateForm(true, "");
  592. txtInvoiceNo.Focus();
  593. @Status=1;
  594. </New>
  595. <View>
  596. tbNo.ReadOnly=true;
  597. dtArrival.Enabled=false;
  598. txtInvoiceNo.ReadOnly=true;
  599. dgProduct.ReadOnly=true;
  600. toolBar.EnableSubmit=false;
  601. toolBar.EnableModify=GetRight(@Title,"修改");
  602. toolBar.EnableDelete=GetRight(@Title,"删除");
  603. toolBar.EnablePrint=true;
  604. toolBar.EnableImport= false;
  605. UpdateForm(true, "");
  606. @Status=2;
  607. </View>
  608. <Modify>
  609. tbNo.ReadOnly=true;
  610. dtArrival.Enabled=true;
  611. txtInvoiceNo.ReadOnly=true;
  612. dgProduct.ReadOnly=false;
  613. dgProduct.SetColumnReadOnly(1,true);
  614. dgProduct.SetColumnReadOnly(2,true);
  615. dgProduct.AllowNew(false);
  616. toolBar.EnableSubmit=GetRight(@Title,"新增");
  617. toolBar.EnableModify=false;
  618. toolBar.EnableDelete=false;
  619. toolBar.EnablePrint=false;
  620. toolBar.EnableImport= false;
  621. UpdateForm(true, "");
  622. txtInvoiceNo.Focus();
  623. @Status=3;
  624. </Modify>
  625. <SubmitButtonClick>
  626. <![CDATA[
  627. if(txtInvoiceNo.CValue=="")
  628. {
  629. MessageBox("请输入发票号码!",@Title);
  630. txtInvoiceNo.Focus();
  631. return;
  632. }
  633. if(RowCount("#OnShipProduct")==0)
  634. {
  635. MessageBox("请输入订单在途产品!",@Title);
  636. dgProduct.Focus();
  637. return;
  638. }
  639. UpdateForm(false, "");
  640. SuspendLayout();
  641. for(@i=0;@i<RowCount("#OnShipProduct");@i++)
  642. {
  643. SetPosition("#OnShipProduct",@i);
  644. if(Equals(#OnShipProduct.No_FromBill,""))
  645. {
  646. MessageBox("采购订单编号不能为空!",@Title);
  647. dgProduct.CurrentRowIndex=@i;
  648. dgProduct.Focus();
  649. ResumeLayout();
  650. return;
  651. }
  652. else
  653. {
  654. if(Search("SearchPurchaseOrderBill",#OnShipProduct.No_FromBill))
  655. {
  656. if(Equals(#PurchaseOrderBill.ID_Assessor,DBNull()))
  657. {
  658. MessageBox("该采购订单未经审核!",@Title);
  659. dgProduct.CurrentRowIndex=@i;
  660. dgProduct.Focus();
  661. ResumeLayout();
  662. return;
  663. }
  664. }
  665. else
  666. {
  667. MessageBox("该采购订单不存在!",@Title);
  668. dgProduct.CurrentRowIndex=@i;
  669. dgProduct.Focus();
  670. ResumeLayout();
  671. return;
  672. }
  673. }
  674. if(Equals(#OnShipProduct.No_FromBillProduct,""))
  675. {
  676. MessageBox("采购订单产品序号不能为空!",@Title);
  677. dgProduct.CurrentRowIndex=@i;
  678. dgProduct.Focus();
  679. ResumeLayout();
  680. return;
  681. }
  682. if(Equals(#OnShipProduct.ID_PurchaseSourceBillProduct,GuidEmpty()))
  683. {
  684. MessageBox("不存在该采购订单产品!",@Title);
  685. dgProduct.CurrentRowIndex=@i;
  686. dgProduct.Focus();
  687. ResumeLayout();
  688. return;
  689. }
  690. if(#OnShipProduct.Quantity_OnShipProduct<=0)
  691. {
  692. MessageBox("本次在途数量必须大于0!",@Title);
  693. dgProduct.CurrentRowIndex=@i;
  694. dgProduct.Focus();
  695. ResumeLayout();
  696. return;
  697. }
  698. Search("SearchSupplier",#OnShipProduct.No_FromBill);
  699. Register_Set("1",#Supplier.No_Supplier);
  700. for(@j=@i+1;@j<=RowCount("#OnShipProduct")-1;@j=@j+1)
  701. {
  702. SetPosition("#OnShipProduct",@j);
  703. Search("SearchSupplier",#OnShipProduct.No_FromBill);
  704. if(!Equals(Register_Get("1"),#Supplier.No_Supplier))
  705. {
  706. dgProduct.CurrentRowIndex=@j;
  707. MessageBox("采购订单的供应商不同,提交失败!",@Title);
  708. dgProduct.CurrentRowIndex=@i;
  709. dgProduct.Focus();
  710. ResumeLayout();
  711. return;
  712. }
  713. }
  714. Register_Remove("1");
  715. SetPosition("#OnShipProduct",@i);
  716. if(Equals(#OnShipProduct.ID_OnShipProduct,GuidEmpty()))
  717. {
  718. #OnShipProduct.ID_OnShipProduct=NewGuid();
  719. }
  720. #OnShipProduct.ID_OnShip=#OnShip.ID_OnShip;
  721. }
  722. ResumeLayout();
  723. if(@Status==1)
  724. {
  725. New();
  726. }
  727. else if(@Status==3)
  728. {
  729. Update();
  730. }
  731. ChangeMode("View");
  732. ]]>
  733. </SubmitButtonClick>
  734. </Lables>
  735. </Form>
  736. </Forms>