FrmStocktakingBill.xml 48 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934
  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <Forms>
  3. <Form Name="FrmStocktakingBill">
  4. <Client>
  5. <Events>
  6. <Load>
  7. <![CDATA[
  8. @Title="盘库作业";
  9. GetSchema();
  10. @SetFlag1=1;
  11. dgProduct.NoMember="No_StocktakingBillProduct";
  12. Search("SearchStockQty",DBNull(),DBNull());
  13. Search("SearchProductStocks",DBNull(),DBNull());
  14. Search("SearchNo_Product","p");
  15. Search("SearchLocationByNo","p");
  16. Search("SearchOneLocation","p","p");
  17. dgProduct.ColumnVisibleByColumnName("UnitPrice_StocktakingBillProduct",!GetFieldRight(@Title,"单价","查看"));
  18. ChangeMode("Search");
  19. ]]>
  20. </Load>
  21. <Closing>
  22. ;<!--TODO-->
  23. </Closing>
  24. <Closed>
  25. ;<!--TODO-->
  26. </Closed>
  27. </Events>
  28. <Mode>
  29. <Search>
  30. <Lable name="Search" />
  31. </Search>
  32. <New>
  33. <Lable name="New" />
  34. </New>
  35. <View>
  36. <Lable name="View" />
  37. </View>
  38. <Modify>
  39. <Lable name="Modify" />
  40. </Modify>
  41. </Mode>
  42. <Controls>
  43. <IKDateTimePicker name="timeMake" DataSource="StocktakingBill.Date_StocktakingBill"/>
  44. <IKTextButton name="tbNo" DataSource="StocktakingBill.No_StocktakingBill">
  45. <Events>
  46. <Enter>
  47. <![CDATA[
  48. if(tbNo.ReadOnly == false)
  49. {
  50. if(tbNo.CValue != StringEmpty())
  51. {
  52. UpdateForm(false, "");
  53. if(Search("SearchStocktakingBillWithNo", tbNo.CValue))
  54. {
  55. ChangeMode("View");
  56. }
  57. else
  58. {
  59. MessageBox("该盘库单不存在!",@Title);
  60. }
  61. }
  62. else
  63. {
  64. MessageBox("请输入盘库单号!", @Title);
  65. }
  66. }
  67. ]]>
  68. </Enter>
  69. <Click>
  70. ShowSearchBox("BillSearch","HAVEDEPOT", "tbNo",tbNo.CValue);
  71. </Click>
  72. </Events>
  73. </IKTextButton>
  74. <IKComboBoxEx name="cbLocation" DisplaySource="StocktakingBill.Name_Location" NoSource="StocktakingBill.No_Location" ValueSource="StocktakingBill.ID_Location" DataSource="Location" DisplayMember="Name_Location" NoMember="No_Location" ValueMember="ID_Location">
  75. <Events>
  76. <Reload>
  77. UpdateForm(false, "cbLocation");
  78. Search("SearchLocation");
  79. UpdateForm(true, "cbLocation");
  80. </Reload>
  81. </Events>
  82. </IKComboBoxEx>
  83. <IKTextBox name="txtMaker" DataSource="StocktakingBill.Name_Creator"/>
  84. <IKTextBox name="txtAssessor" DataSource="StocktakingBill.Name_Assessor"/>
  85. <IKDateTimeText name="dtAssessDate" DataSource="StocktakingBill.AssessDate_StocktakingBill"/>
  86. <IKTextBox name="txtComment" DataSource="StocktakingBill.Comment_StocktakingBill"/>
  87. <IKDataGridEx name="dgProduct" DataSource="StocktakingBillProduct" TableStyleIndex="0">
  88. <DataColumn Index="0" DataSource="StocktakingBillProduct.No_StocktakingBillProduct"/>
  89. <DataColumn Index="1" DataSource="StocktakingBillProduct.No_Product" >
  90. <IKDataGridTextButtonColumn>
  91. <Events>
  92. <Click>
  93. @SetFlag=1;
  94. ShowSearchBox("ProductSearch","INFOMATION",#StocktakingBillProduct.No_Product);
  95. </Click>
  96. <SetFlagBeforeClick>
  97. @SetFlag=0;
  98. </SetFlagBeforeClick>
  99. </Events>
  100. </IKDataGridTextButtonColumn>
  101. </DataColumn>
  102. <DataColumn Index="2" DataSource="StocktakingBillProduct.Name_Product"/>
  103. <DataColumn Index="3" DataSource="StocktakingBillProduct.No_Location" >
  104. <IKDataGridTextButtonColumn>
  105. <Events>
  106. <Click>
  107. @SetFlag1=1;
  108. @LocationNo = ShowSearchBox("LocationSearch","INFOMATION",#StocktakingBillProduct.No_Location);
  109. if(@LocationNo != "")
  110. #StocktakingBillProduct.No_Location = @LocationNo;
  111. </Click>
  112. <SetFlagBeforeClick>
  113. @SetFlag1=0;
  114. </SetFlagBeforeClick>
  115. </Events>
  116. </IKDataGridTextButtonColumn>
  117. </DataColumn>
  118. <DataColumn Index="4" DataSource="StocktakingBillProduct.Name_Location" />
  119. <DataColumn Index="5" DataSource="StocktakingBillProduct.StockQty_StocktakingBillProduct"/>
  120. <DataColumn Index="6" DataSource="StocktakingBillProduct.Quantity_StocktakingBillProduct"/>
  121. <DataColumn Index="7" DataSource="StocktakingBillProduct.Unit_Product" />
  122. <DataColumn Index="8" DataSource="StocktakingBillProduct.Account" />
  123. <DataColumn Index="9" DataSource="StocktakingBillProduct.UnitPrice_StocktakingBillProduct" />
  124. <DataColumn Index="10" DataSource="StocktakingBillProduct.Comment_StocktakingBillProduct" />
  125. </IKDataGridEx>
  126. <IKFormToolBar name="toolBar">
  127. <Events>
  128. <ClickFirst>
  129. if(Search("SearchStocktakingBillFirst", tbNo.CValue))
  130. {
  131. ChangeMode("View");
  132. }
  133. </ClickFirst>
  134. <ClickPrev>
  135. if(Search("SearchStocktakingBillPrevious", tbNo.CValue))
  136. {
  137. ChangeMode("View");
  138. }
  139. </ClickPrev>
  140. <ClickNext>
  141. if(Search("SearchStocktakingBillNext", tbNo.CValue))
  142. {
  143. ChangeMode("View");
  144. }
  145. </ClickNext>
  146. <ClickLast>
  147. if(Search("SearchStocktakingBillLast", tbNo.CValue))
  148. {
  149. ChangeMode("View");
  150. }
  151. </ClickLast>
  152. <ClickNew>
  153. @NewNumber=GetNextAutoNumber(true);
  154. if(@NewNumber != "")
  155. {
  156. ChangeMode("New");
  157. tbNo.CValue=@NewNumber;
  158. }
  159. </ClickNew>
  160. <ClickEmpty>
  161. ChangeMode("Search");
  162. </ClickEmpty>
  163. <ClickSubmit>
  164. <Lable name="SubmitButtonClick" />
  165. </ClickSubmit>
  166. <ClickModify>
  167. ChangeMode("Modify");
  168. </ClickModify>
  169. <ClickDelete>
  170. Delete();
  171. ChangeMode("Search");
  172. </ClickDelete>
  173. <ClickPrint>
  174. ShowPrintBox("BillSearch",#StocktakingBill.No_StocktakingBill,#StocktakingBill.No_StocktakingBill,GetFieldRight(@Title,"单价","查看"));
  175. </ClickPrint>
  176. <ClickAudit>
  177. <![CDATA[
  178. BeginAudit();
  179. #StocktakingBill.ID_Assessor = GetLoginUserID();
  180. #StocktakingBill.Name_Assessor = GetCurrentUser();
  181. #StocktakingBill.AssessDate_StocktakingBill = DateTimeNow();
  182. Audit();
  183. ChangeMode("View");
  184. EndAudit();
  185. ]]>
  186. </ClickAudit>
  187. <ClickUnAudit>
  188. <![CDATA[
  189. BeginUnAudit();
  190. #StocktakingBill.ID_Assessor = DBNull();
  191. #StocktakingBill.Name_Assessor = "";
  192. UnAudit();
  193. ChangeMode("View");
  194. EndUnAudit();
  195. ]]>
  196. </ClickUnAudit>
  197. <ClickImport>
  198. ;
  199. </ClickImport>
  200. <ClickExport>
  201. ;
  202. </ClickExport>
  203. <ClickClose>
  204. ;
  205. </ClickClose>
  206. <ClickExpand>
  207. ;
  208. </ClickExpand>
  209. <ClickImportItem>
  210. ;
  211. <!--使用前先访问ToolBar的MenuItemText属性以确定选中的是那一项-->
  212. </ClickImportItem>
  213. <ClickExportItem>
  214. if(toolBar.MenuItemText=="库存异动作业")
  215. {
  216. ExportBillProductStart("#ModifyDepotBillProduct.Type_FromBill",4,"#ModifyDepotBillProduct.SourceBillName_ModifyDepotBillProduct","盘库单","#ModifyDepotBillProduct.No_FromBill",#StocktakingBill.No_StocktakingBill,"#ModifyDepotBill.ChangedDepot_ModifyDepotBill",#StocktakingBill.Name_Location);
  217. ExportBillProduct("dgProduct","#StocktakingBillProduct","#ModifyDepotBillProduct.No_FromBillProduct","#StocktakingBillProduct.No_StocktakingBillProduct");
  218. }
  219. <!--初始化目标数据-->
  220. <!--使用前先访问ToolBar的MenuItemText属性以确定选中的是那一项-->
  221. </ClickExportItem>
  222. </Events>
  223. </IKFormToolBar>
  224. </Controls>
  225. <Tables>
  226. <Table name="StocktakingBillProduct">
  227. <Events>
  228. <ColumnsChanged>
  229. <No_Product>
  230. <![CDATA[
  231. if(#StocktakingBillProduct.No_Product == "" || !Search("SearchNo_Product",#StocktakingBillProduct.No_Product))
  232. {
  233. if(#StocktakingBillProduct.No_Product != "")
  234. MessageBox("该产品不存在!",@Title);
  235. #StocktakingBillProduct.ID_Product = GuidEmpty();
  236. #StocktakingBillProduct.Unit_Product = "";
  237. #StocktakingBillProduct.Name_Product = "";
  238. #StocktakingBillProduct.UnitPrice_StocktakingBillProduct = 0.00;
  239. }
  240. else
  241. {
  242. if(!Equals(#NoProduct.SuspendDate_Product,DBNull()))
  243. {
  244. MessageBox("该产品已停用!",@Title);
  245. }
  246. #StocktakingBillProduct.ID_Product = #NoProduct.ID_Product;
  247. #StocktakingBillProduct.Unit_Product = #NoProduct.Unit_Product;
  248. #StocktakingBillProduct.Name_Product = #NoProduct.Name_Product;
  249. #StocktakingBillProduct.UnitPrice_StocktakingBillProduct = #NoProduct.Cost_Product;
  250. if( Search("SearchOneLocation",#StocktakingBillProduct.No_Product,GetCurrentDepot()))
  251. {
  252. #StocktakingBillProduct.No_Location = #OneLocation.No_Location;
  253. #StocktakingBillProduct.Name_Location = #OneLocation.Name_Location;
  254. #StocktakingBillProduct.ID_Location = #OneLocation.ID_Location;
  255. if(!Search("SearchStockQty",#StocktakingBillProduct.ID_Product,#StocktakingBillProduct.ID_Location))
  256. {
  257. #StocktakingBillProduct.StockQty_StocktakingBillProduct = 0.00;
  258. }
  259. else
  260. {
  261. #StocktakingBillProduct.StockQty_StocktakingBillProduct = #StockQty.StockQty_ProductStocks;
  262. }
  263. }
  264. }
  265. ]]>
  266. </No_Product>
  267. <Name_Location>
  268. <![CDATA[
  269. if(!Search("SearchStockQty",#StocktakingBillProduct.ID_Product,#StocktakingBillProduct.ID_Location))
  270. {
  271. #StocktakingBillProduct.StockQty_StocktakingBillProduct = 0.00;
  272. }
  273. else
  274. {
  275. #StocktakingBillProduct.StockQty_StocktakingBillProduct = #StockQty.StockQty_ProductStocks;
  276. }
  277. ]]>
  278. </Name_Location>
  279. <Quantity_StocktakingBillProduct>
  280. #StocktakingBillProduct.Account = #StocktakingBillProduct.Quantity_StocktakingBillProduct - #StocktakingBillProduct.StockQty_StocktakingBillProduct;
  281. </Quantity_StocktakingBillProduct>
  282. <StockQty_StocktakingBillProduct>
  283. #StocktakingBillProduct.Account = #StocktakingBillProduct.Quantity_StocktakingBillProduct - #StocktakingBillProduct.StockQty_StocktakingBillProduct;
  284. </StockQty_StocktakingBillProduct>
  285. <No_Location>
  286. if(@SetFlag1==0)
  287. {
  288. return;
  289. }
  290. if(#StocktakingBillProduct.No_Location != StringEmpty())
  291. {
  292. if(!Search("SearchLocationByNo", #StocktakingBillProduct.No_Location))
  293. {
  294. MessageBox("不存在此库位编号",@Title);
  295. #StocktakingBillProduct.ID_Location=GuidEmpty();
  296. #StocktakingBillProduct.Name_Location=StringEmpty();
  297. }
  298. else
  299. {
  300. #StocktakingBillProduct.ID_Location=#Location.ID_Location;
  301. #StocktakingBillProduct.Name_Location=#Location.Name_Location;
  302. if(Search("SearchProductStocks", #StocktakingBillProduct.ID_Product, #Location.ID_Location))
  303. #StocktakingBillProduct.StockQty_StocktakingBillProduct = #ProductStocks.StockQty_ProductStocks;
  304. }
  305. }
  306. </No_Location>
  307. </ColumnsChanged>
  308. </Events>
  309. </Table>
  310. </Tables>
  311. <LockInfomation LockID="ID_StocktakingBill" LockNO="No_StocktakingBill" LockSearchFunction="SearchStocktakingBillWithNo" LockAudit="ID_Assessor"/>
  312. <LogInfomation LogNO="#StocktakingBill.No_StocktakingBill" RecordFormField="" RecordDataGridField=""/>
  313. <ChildForms>
  314. <ChildForm name="BillSearch" DataSource="StocktakingBill" SearchFunction="SearchAllBill" SearchFunctionByNo="SearchStocktakingBillWithNo">
  315. <DataColumn Index="0" MappingName="#StocktakingBill.No_StocktakingBill" HeaderText="盘库单号" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  316. <DataColumn Index="1" MappingName="#StocktakingBill.Date_StocktakingBill" HeaderText="制单日期" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  317. <DataColumn Index="2" MappingName="#StocktakingBill.Name_Location" HeaderText="盘点仓库" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  318. <DataColumn Index="3" MappingName="#StocktakingBill.Comment_StocktakingBill" HeaderText="备注" Width="75" ColumnType="IKDataGridTextBoxColumn"/>
  319. </ChildForm>
  320. <ChildForm name="ProductSearch" DataSource="Product" SearchFunction="SearchAllProduct" SearchFunctionByNo="" MappingName="产品" ReturnDataSource="StocktakingBillProduct" ShowCheckBox="true">
  321. <DataColumn Index="0" MappingName="#Product.No_Product" HeaderText="产品编号" Width="120" ColumnType="IKDataGridTextBoxColumn" ReturnMappingName="#StocktakingBillProduct.No_Product"/>
  322. <DataColumn Index="1" MappingName="#Product.Name_Product" HeaderText="产品简称" Width="120" ColumnType="IKDataGridTextBoxColumn"/>
  323. <DataColumn Index="2" MappingName="#Product.Type_Product" HeaderText="产品大类" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  324. <DataColumn Index="3" MappingName="#Product.Name_Location" HeaderText="所在库位" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  325. <DataColumn Index="4" MappingName="#Product.Unit_Product" HeaderText="基本单位" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  326. <DataColumn Index="5" MappingName="#Product.Suspend" HeaderText="暂停使用" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  327. </ChildForm>
  328. <ChildForm name="LocationSearch" DataSource="Location" SearchFunction="SearchAllLocation" SearchFunctionByNo="" MappingName="库位" ReturnDataSource="StocktakingBillProduct" ShowCheckBox="false">
  329. <DataColumn Index="0" MappingName="#Location.No_Location" HeaderText="库位编号" Width="120" ColumnType="IKDataGridTextBoxColumn" ReturnMappingName="#StocktakingBillProduct.No_Location" />
  330. <DataColumn Index="1" MappingName="#Location.Name_Location" HeaderText="库位名称" Width="120" ColumnType="IKDataGridTextBoxColumn"/>
  331. </ChildForm>
  332. </ChildForms>
  333. </Client>
  334. <Server>
  335. <Tables>
  336. <Table name="StocktakingBill" Type="Parent">
  337. <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 StocktakingBill.*,a.Name_User AS Name_Creator, b.Name_User AS Name_Assessor, c.Name_User AS LastModUserName,
  338. Location.No_Location, Location.Name_Location
  339. FROM StocktakingBill
  340. LEFT JOIN AppUser a ON a.ID_User = StocktakingBill.ID_Creator
  341. LEFT JOIN AppUser b ON b.ID_User = StocktakingBill.ID_Assessor
  342. LEFT JOIN AppUser c ON c.ID_User = StocktakingBill.LastModUser_StocktakingBill
  343. LEFT JOIN Location ON Location.ID_Location = StocktakingBill.ID_Location "/>
  344. <New CmdType="Text" CmdText="INSERT INTO StocktakingBill(ID_StocktakingBill,
  345. No_StocktakingBill,
  346. Date_StocktakingBill,
  347. ID_Location,
  348. ID_Creator,
  349. ID_Assessor,
  350. AssessDate_StocktakingBill,
  351. Comment_StocktakingBill,
  352. CreateDate_StocktakingBill,
  353. LastModUser_StocktakingBill,
  354. LastModDate_StocktakingBill
  355. )
  356. VALUES(@ID_StocktakingBill,
  357. @No_StocktakingBill,
  358. @Date_StocktakingBill,
  359. @ID_Location,
  360. @ID_Creator,
  361. @ID_Assessor,
  362. @AssessDate_StocktakingBill,
  363. @Comment_StocktakingBill,
  364. @CreateDate_StocktakingBill,
  365. @LastModUser_StocktakingBill,
  366. @LastModDate_StocktakingBill
  367. ) ">
  368. <Params>
  369. <Param name="@ID_StocktakingBill" type="StocktakingBill.ID_StocktakingBill" sourceColumn="ID_StocktakingBill" />
  370. <Param name="@No_StocktakingBill" type="StocktakingBill.No_StocktakingBill" sourceColumn="No_StocktakingBill" />
  371. <Param name="@Date_StocktakingBill" type="StocktakingBill.Date_StocktakingBill" sourceColumn="Date_StocktakingBill" />
  372. <Param name="@ID_Location" type="StocktakingBill.ID_Location" sourceColumn="ID_Location" />
  373. <Param name="@ID_Creator" type="StocktakingBill.ID_Creator" sourceColumn="ID_Creator" />
  374. <Param name="@ID_Assessor" type="StocktakingBill.ID_Assessor" sourceColumn="ID_Assessor" />
  375. <Param name="@AssessDate_StocktakingBill" type="StocktakingBill.AssessDate_StocktakingBill" sourceColumn="AssessDate_StocktakingBill" />
  376. <Param name="@Comment_StocktakingBill" type="StocktakingBill.Comment_StocktakingBill" sourceColumn="Comment_StocktakingBill" />
  377. <Param name="@CreateDate_StocktakingBill" type="StocktakingBill.CreateDate_StocktakingBill" sourceColumn="CreateDate_StocktakingBill" />
  378. <Param name="@LastModUser_StocktakingBill" type="StocktakingBill.LastModUser_StocktakingBill" sourceColumn="LastModUser_StocktakingBill" />
  379. <Param name="@LastModDate_StocktakingBill" type="StocktakingBill.LastModDate_StocktakingBill" sourceColumn="LastModDate_StocktakingBill" />
  380. </Params>
  381. </New>
  382. <Update CmdType="Text" CmdText="UPDATE StocktakingBill
  383. SET No_StocktakingBill = @No_StocktakingBill,
  384. Date_StocktakingBill = @Date_StocktakingBill,
  385. ID_Location = @ID_Location,
  386. ID_Creator = @ID_Creator,
  387. ID_Assessor = @ID_Assessor,
  388. AssessDate_StocktakingBill = @AssessDate_StocktakingBill,
  389. Comment_StocktakingBill = @Comment_StocktakingBill,
  390. CreateDate_StocktakingBill = @CreateDate_StocktakingBill,
  391. LastModUser_StocktakingBill = @LastModUser_StocktakingBill,
  392. LastModDate_StocktakingBill = @LastModDate_StocktakingBill
  393. WHERE ID_StocktakingBill = @ID_StocktakingBill ">
  394. <Params>
  395. <Param name="@ID_StocktakingBill" type="StocktakingBill.ID_StocktakingBill" sourceColumn="ID_StocktakingBill" />
  396. <Param name="@No_StocktakingBill" type="StocktakingBill.No_StocktakingBill" sourceColumn="No_StocktakingBill" />
  397. <Param name="@Date_StocktakingBill" type="StocktakingBill.Date_StocktakingBill" sourceColumn="Date_StocktakingBill" />
  398. <Param name="@ID_Location" type="StocktakingBill.ID_Location" sourceColumn="ID_Location" />
  399. <Param name="@ID_Creator" type="StocktakingBill.ID_Creator" sourceColumn="ID_Creator" />
  400. <Param name="@ID_Assessor" type="StocktakingBill.ID_Assessor" sourceColumn="ID_Assessor" />
  401. <Param name="@AssessDate_StocktakingBill" type="StocktakingBill.AssessDate_StocktakingBill" sourceColumn="AssessDate_StocktakingBill" />
  402. <Param name="@Comment_StocktakingBill" type="StocktakingBill.Comment_StocktakingBill" sourceColumn="Comment_StocktakingBill" />
  403. <Param name="@CreateDate_StocktakingBill" type="StocktakingBill.CreateDate_StocktakingBill" sourceColumn="CreateDate_StocktakingBill" />
  404. <Param name="@LastModUser_StocktakingBill" type="StocktakingBill.LastModUser_StocktakingBill" sourceColumn="LastModUser_StocktakingBill" />
  405. <Param name="@LastModDate_StocktakingBill" type="StocktakingBill.LastModDate_StocktakingBill" sourceColumn="LastModDate_StocktakingBill" />
  406. </Params>
  407. </Update>
  408. <Audit CmdType="Text" CmdText=" UPDATE StocktakingBill SET
  409. ID_Assessor=@ID_Assessor,
  410. AssessDate_StocktakingBill=@AssessDate_StocktakingBill
  411. WHERE ID_StocktakingBill=@ID_StocktakingBill">
  412. <Params>
  413. <Param name="@ID_StocktakingBill" type="StocktakingBill.ID_StocktakingBill" sourceColumn="ID_StocktakingBill" />
  414. <Param name="@No_StocktakingBill" type="StocktakingBill.No_StocktakingBill" sourceColumn="No_StocktakingBill" />
  415. <Param name="@ID_Assessor" type="StocktakingBill.ID_Assessor" sourceColumn="ID_Assessor" />
  416. <Param name="@AssessDate_StocktakingBill" type="StocktakingBill.AssessDate_StocktakingBill" sourceColumn="AssessDate_StocktakingBill" />
  417. </Params>
  418. </Audit>
  419. <Delete CmdType="Text" CmdText="DELETE StocktakingBillProduct WHERE StocktakingBillProduct.ID_StocktakingBill = @ID_StocktakingBill
  420. DELETE StocktakingBill WHERE StocktakingBill.ID_StocktakingBill = @ID_StocktakingBill">
  421. <Params>
  422. <Param name="@ID_StocktakingBill" type="StocktakingBill.ID_StocktakingBill" sourceColumn="ID_StocktakingBill" />
  423. </Params>
  424. </Delete>
  425. <FKErrorReport ErrorMessage="本记录被其他单据使用过,删除失败!"/>
  426. <UNIQUEErrorReport ErrorMessage="销货出库单号已存在,提交失败!"/>
  427. </Table>
  428. <Table name="StocktakingBillProduct" Type="Child">
  429. <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 StocktakingBillProduct.*,convert(decimal(14,2),0) as Account, '' as No_StocktakingBill,
  430. Product.No_Product,Product.Name_Product,Product.Unit_Product,
  431. Location.No_Location, Location.Name_Location, Location.ID_Location
  432. FROM StocktakingBillProduct
  433. LEFT JOIN Product ON Product.ID_Product = StocktakingBillProduct.ID_Product
  434. LEFT JOIN Location ON Location.ID_Location = StocktakingBillProduct.ID_Location "/>
  435. <New CmdType="Text" CmdText="INSERT INTO StocktakingBillProduct(ID_StocktakingBillProduct,
  436. No_StocktakingBillProduct,
  437. ID_StocktakingBill,
  438. ID_Product,
  439. ID_Location,
  440. StockQty_StocktakingBillProduct,
  441. Quantity_StocktakingBillProduct,
  442. UnitPrice_StocktakingBillProduct,
  443. Comment_StocktakingBillProduct
  444. )
  445. VALUES(@ID_StocktakingBillProduct,
  446. @No_StocktakingBillProduct,
  447. @ID_StocktakingBill,
  448. @ID_Product,
  449. @ID_Location,
  450. @StockQty_StocktakingBillProduct,
  451. @Quantity_StocktakingBillProduct,
  452. @UnitPrice_StocktakingBillProduct,
  453. @Comment_StocktakingBillProduct)" >
  454. <Params>
  455. <Param name="@ID_StocktakingBillProduct" type="StocktakingBillProduct.ID_StocktakingBillProduct" sourceColumn="ID_StocktakingBillProduct" />
  456. <Param name="@No_StocktakingBillProduct" type="StocktakingBillProduct.No_StocktakingBillProduct" sourceColumn="No_StocktakingBillProduct" />
  457. <Param name="@ID_StocktakingBill" type="StocktakingBillProduct.ID_StocktakingBill" sourceColumn="ID_StocktakingBill" />
  458. <Param name="@ID_Product" type="StocktakingBillProduct.ID_Product" sourceColumn="ID_Product" />
  459. <Param name="@ID_Location" type="StocktakingBillProduct.ID_Location" sourceColumn="ID_Location" />
  460. <Param name="@StockQty_StocktakingBillProduct" type="StocktakingBillProduct.StockQty_StocktakingBillProduct" sourceColumn="StockQty_StocktakingBillProduct" />
  461. <Param name="@Quantity_StocktakingBillProduct" type="StocktakingBillProduct.Quantity_StocktakingBillProduct" sourceColumn="Quantity_StocktakingBillProduct" />
  462. <Param name="@UnitPrice_StocktakingBillProduct" type="StocktakingBillProduct.UnitPrice_StocktakingBillProduct" sourceColumn="UnitPrice_StocktakingBillProduct" />
  463. <Param name="@Comment_StocktakingBillProduct" type="StocktakingBillProduct.Comment_StocktakingBillProduct" sourceColumn="Comment_StocktakingBillProduct" />
  464. </Params>
  465. </New>
  466. <Update CmdType="Text" CmdText="UPDATE StocktakingBillProduct
  467. SET No_StocktakingBillProduct = @No_StocktakingBillProduct ,
  468. ID_StocktakingBill = @ID_StocktakingBill ,
  469. ID_Product = @ID_Product ,
  470. ID_Location = @ID_Location ,
  471. StockQty_StocktakingBillProduct = @StockQty_StocktakingBillProduct ,
  472. Quantity_StocktakingBillProduct = @Quantity_StocktakingBillProduct ,
  473. UnitPrice_StocktakingBillProduct = @UnitPrice_StocktakingBillProduct ,
  474. Comment_StocktakingBillProduct = @Comment_StocktakingBillProduct
  475. WHERE ID_StocktakingBillProduct = @ID_StocktakingBillProduct " >
  476. <Params>
  477. <Param name="@ID_StocktakingBillProduct" type="StocktakingBillProduct.ID_StocktakingBillProduct" sourceColumn="ID_StocktakingBillProduct" />
  478. <Param name="@No_StocktakingBillProduct" type="StocktakingBillProduct.No_StocktakingBillProduct" sourceColumn="No_StocktakingBillProduct" />
  479. <Param name="@ID_StocktakingBill" type="StocktakingBillProduct.ID_StocktakingBill" sourceColumn="ID_StocktakingBill" />
  480. <Param name="@ID_Product" type="StocktakingBillProduct.ID_Product" sourceColumn="ID_Product" />
  481. <Param name="@ID_Location" type="StocktakingBillProduct.ID_Location" sourceColumn="ID_Location" />
  482. <Param name="@StockQty_StocktakingBillProduct" type="StocktakingBillProduct.StockQty_StocktakingBillProduct" sourceColumn="StockQty_StocktakingBillProduct" />
  483. <Param name="@Quantity_StocktakingBillProduct" type="StocktakingBillProduct.Quantity_StocktakingBillProduct" sourceColumn="Quantity_StocktakingBillProduct" />
  484. <Param name="@UnitPrice_StocktakingBillProduct" type="StocktakingBillProduct.UnitPrice_StocktakingBillProduct" sourceColumn="UnitPrice_StocktakingBillProduct" />
  485. <Param name="@Comment_StocktakingBillProduct" type="StocktakingBillProduct.Comment_StocktakingBillProduct" sourceColumn="Comment_StocktakingBillProduct" />
  486. </Params>
  487. </Update>
  488. <Delete CmdType="Text" CmdText="DELETE StocktakingBillProduct WHERE StocktakingBillProduct.ID_StocktakingBillProduct = @ID_StocktakingBillProduct">
  489. <Params>
  490. <Param name="@ID_StocktakingBillProduct" type="StocktakingBillProduct.ID_StocktakingBillProduct" sourceColumn="ID_StocktakingBillProduct" />
  491. </Params>
  492. </Delete>
  493. </Table>
  494. </Tables>
  495. <Search>
  496. <SearchStocktakingBillWithNo CmdType="Text" CmdText=" DECLARE @ID_StocktakingBill uniqueidentifier
  497. SELECT StocktakingBill.*,a.Name_User AS Name_Creator, b.Name_User AS Name_Assessor, c.Name_User AS LastModUserName,
  498. Location.No_Location, Location.Name_Location
  499. FROM StocktakingBill
  500. LEFT JOIN AppUser a ON a.ID_User = StocktakingBill.ID_Creator
  501. LEFT JOIN AppUser b ON b.ID_User = StocktakingBill.ID_Assessor
  502. LEFT JOIN AppUser c ON c.ID_User = StocktakingBill.LastModUser_StocktakingBill
  503. LEFT JOIN Location ON Location.ID_Location = StocktakingBill.ID_Location
  504. WHERE StocktakingBill.No_StocktakingBill = @No_StocktakingBill
  505. SELECT @ID_StocktakingBill = StocktakingBill.ID_StocktakingBill FROM StocktakingBill WHERE StocktakingBill.No_StocktakingBill = @No_StocktakingBill
  506. SELECT StocktakingBillProduct.*,convert(decimal(14,2),Quantity_StocktakingBillProduct - StockQty_StocktakingBillProduct) as Account,
  507. Product.No_Product,Product.Name_Product,Product.Unit_Product,
  508. Location.No_Location, Location.Name_Location,Location.ID_Location,@No_StocktakingBill as No_StocktakingBill
  509. FROM StocktakingBillProduct
  510. LEFT JOIN Product ON Product.ID_Product = StocktakingBillProduct.ID_Product
  511. LEFT JOIN Location ON Location.ID_Location = StocktakingBillProduct.ID_Location
  512. WHERE StocktakingBillProduct.ID_StocktakingBill=@ID_StocktakingBill
  513. order by CAST(No_StocktakingBillProduct AS INT)">
  514. <Params>
  515. <Param name="@No_StocktakingBill" type="StocktakingBill.No_StocktakingBill" Index="0" />
  516. </Params>
  517. <Tables>
  518. <Table name="StocktakingBill" />
  519. <Table name="StocktakingBillProduct" />
  520. </Tables>
  521. </SearchStocktakingBillWithNo>
  522. <SearchNo_Product CmdType="Text" CmdText=" SELECT Product.ID_Product, Product.No_Product,Product.Name_Product,
  523. Product.SuspendDate_Product, Product.Unit_Product,
  524. Product.Cost_Product,AvailableQty_ProductStocks,Cost_Product
  525. FROM Product WHERE Product.No_Product=@No_Product">
  526. <Params>
  527. <Param name="@No_Product" type="Product.No_Product" Index="0" />
  528. </Params>
  529. <Tables>
  530. <Table name="NoProduct" />
  531. </Tables>
  532. </SearchNo_Product>
  533. <SearchProductStocks CmdType="Text" CmdText="SELECT StockQty_ProductStocks FROM ProductStocks WHERE ID_Product=@ID_Product AND
  534. ID_Location=@ID_Location">
  535. <Params>
  536. <Param name="@ID_Product" type="Product.ID_Product" Index="0" />
  537. <Param name="@ID_Location" type="Location.ID_Location" Index="1" />
  538. </Params>
  539. <Tables>
  540. <Table name="ProductStocks" />
  541. </Tables>
  542. </SearchProductStocks>
  543. <SearchLocationByNo CmdType="Text" CmdText="SELECT ID_Location, Name_Location FROM Location WHERE No_Location=@No_Location
  544. ">
  545. <Params>
  546. <Param name="@No_Location" type="Location.No_Location" Index="0" />
  547. </Params>
  548. <Tables>
  549. <Table name="Location" />
  550. </Tables>
  551. </SearchLocationByNo>
  552. <SearchAllLocation CmdType="Text" CmdText="SELECT No_Location,Name_Location FROM Location ">
  553. <Tables>
  554. <Table name="Location" />
  555. </Tables>
  556. </SearchAllLocation>
  557. <SearchAllBill CmdType="Text" CmdText=" SELECT StocktakingBill.*,a.Name_User AS Name_Creator, b.Name_User AS Name_Assessor, c.Name_User AS LastModUserName,
  558. Location.No_Location, Location.Name_Location
  559. FROM StocktakingBill
  560. LEFT JOIN AppUser a ON a.ID_User = StocktakingBill.ID_Creator
  561. LEFT JOIN AppUser b ON b.ID_User = StocktakingBill.ID_Assessor
  562. LEFT JOIN AppUser c ON c.ID_User = StocktakingBill.LastModUser_StocktakingBill
  563. LEFT JOIN Location ON Location.ID_Location = StocktakingBill.ID_Location ">
  564. <Tables>
  565. <Table name="AllBill" />
  566. </Tables>
  567. </SearchAllBill>
  568. <SearchLocation CmdType="Text" CmdText="SELECT Name_Location,ID_Location,No_Location FROM Location WHERE Level_Location=0">
  569. <Tables>
  570. <Table name="Location" />
  571. </Tables>
  572. </SearchLocation>
  573. <SearchProductLocation CmdType="Text" CmdText=" SELECT Name_Location,ID_Location FROM Location WHERE ID_Warehouse=@ID_Location AND LowestLevel_Location=1">
  574. <Params>
  575. <Param name="@ID_Location" type="Location.ID_Location" Index="0" />
  576. </Params>
  577. <Tables>
  578. <Table name="ProductLocationFromWarehouse" />
  579. </Tables>
  580. </SearchProductLocation>
  581. <SearchStocktakingBillFirst CmdType="Text" CmdText="DECLARE @StocktakingBillNo nvarchar(64)
  582. SELECT TOP 1 @StocktakingBillNo = StocktakingBill.No_StocktakingBill FROM StocktakingBill ORDER BY StocktakingBill.No_StocktakingBill
  583. DECLARE @ID_StocktakingBill uniqueidentifier
  584. SELECT StocktakingBill.*,a.Name_User AS Name_Creator, b.Name_User AS Name_Assessor, c.Name_User AS LastModUserName,
  585. Location.No_Location, Location.Name_Location
  586. FROM StocktakingBill
  587. LEFT JOIN AppUser a ON a.ID_User = StocktakingBill.ID_Creator
  588. LEFT JOIN AppUser b ON b.ID_User = StocktakingBill.ID_Assessor
  589. LEFT JOIN AppUser c ON c.ID_User = StocktakingBill.LastModUser_StocktakingBill
  590. LEFT JOIN Location ON Location.ID_Location = StocktakingBill.ID_Location
  591. WHERE StocktakingBill.No_StocktakingBill = @StocktakingBillNo
  592. SELECT @ID_StocktakingBill = StocktakingBill.ID_StocktakingBill FROM StocktakingBill WHERE StocktakingBill.No_StocktakingBill = @StocktakingBillNo
  593. SELECT StocktakingBillProduct.*,convert(decimal(14,2),Quantity_StocktakingBillProduct - StockQty_StocktakingBillProduct) as Account,
  594. Product.No_Product,Product.Name_Product,Product.Unit_Product,
  595. Location.No_Location, Location.Name_Location,Location.ID_Location,@StocktakingBillNo as No_StocktakingBill
  596. FROM StocktakingBillProduct
  597. LEFT JOIN Product ON Product.ID_Product = StocktakingBillProduct.ID_Product
  598. LEFT JOIN Location ON Location.ID_Location = StocktakingBillProduct.ID_Location
  599. WHERE StocktakingBillProduct.ID_StocktakingBill=@ID_StocktakingBill
  600. order by CAST(No_StocktakingBillProduct AS INT)">
  601. <Tables>
  602. <Table name="StocktakingBill" />
  603. <Table name="StocktakingBillProduct" />
  604. </Tables>
  605. </SearchStocktakingBillFirst>
  606. <SearchStocktakingBillPrevious CmdType="Text" CmdText="DECLARE @StocktakingBillNo nvarchar(64)
  607. SELECT TOP 1 @StocktakingBillNo = StocktakingBill.No_StocktakingBill FROM StocktakingBill WHERE StocktakingBill.No_StocktakingBill &lt; @No_StocktakingBill ORDER BY StocktakingBill.No_StocktakingBill DESC
  608. DECLARE @ID_StocktakingBill uniqueidentifier
  609. SELECT StocktakingBill.*,a.Name_User AS Name_Creator, b.Name_User AS Name_Assessor, c.Name_User AS LastModUserName,
  610. Location.No_Location, Location.Name_Location
  611. FROM StocktakingBill
  612. LEFT JOIN AppUser a ON a.ID_User = StocktakingBill.ID_Creator
  613. LEFT JOIN AppUser b ON b.ID_User = StocktakingBill.ID_Assessor
  614. LEFT JOIN AppUser c ON c.ID_User = StocktakingBill.LastModUser_StocktakingBill
  615. LEFT JOIN Location ON Location.ID_Location = StocktakingBill.ID_Location
  616. WHERE StocktakingBill.No_StocktakingBill = @StocktakingBillNo
  617. SELECT @ID_StocktakingBill = StocktakingBill.ID_StocktakingBill FROM StocktakingBill WHERE StocktakingBill.No_StocktakingBill = @StocktakingBillNo
  618. SELECT StocktakingBillProduct.*,convert(decimal(14,2),Quantity_StocktakingBillProduct - StockQty_StocktakingBillProduct) as Account,
  619. Product.No_Product,Product.Name_Product,Product.Unit_Product,
  620. Location.No_Location, Location.Name_Location,Location.ID_Location,@StocktakingBillNo as No_StocktakingBill
  621. FROM StocktakingBillProduct
  622. LEFT JOIN Product ON Product.ID_Product = StocktakingBillProduct.ID_Product
  623. LEFT JOIN Location ON Location.ID_Location = StocktakingBillProduct.ID_Location
  624. WHERE StocktakingBillProduct.ID_StocktakingBill=@ID_StocktakingBill
  625. order by CAST(No_StocktakingBillProduct AS INT)">
  626. <Params>
  627. <Param name="@No_StocktakingBill" type="StocktakingBill.No_StocktakingBill" Index="0" />
  628. </Params>
  629. <Tables>
  630. <Table name="StocktakingBill" />
  631. <Table name="StocktakingBillProduct" />
  632. </Tables>
  633. </SearchStocktakingBillPrevious>
  634. <SearchStocktakingBillNext CmdType="Text" CmdText="DECLARE @StocktakingBillNo nvarchar(64)
  635. SELECT TOP 1 @StocktakingBillNo = StocktakingBill.No_StocktakingBill FROM StocktakingBill WHERE StocktakingBill.No_StocktakingBill &gt; @No_StocktakingBill ORDER BY StocktakingBill.No_StocktakingBill
  636. DECLARE @ID_StocktakingBill uniqueidentifier
  637. SELECT StocktakingBill.*,a.Name_User AS Name_Creator, b.Name_User AS Name_Assessor, c.Name_User AS LastModUserName,
  638. Location.No_Location, Location.Name_Location
  639. FROM StocktakingBill
  640. LEFT JOIN AppUser a ON a.ID_User = StocktakingBill.ID_Creator
  641. LEFT JOIN AppUser b ON b.ID_User = StocktakingBill.ID_Assessor
  642. LEFT JOIN AppUser c ON c.ID_User = StocktakingBill.LastModUser_StocktakingBill
  643. LEFT JOIN Location ON Location.ID_Location = StocktakingBill.ID_Location
  644. WHERE StocktakingBill.No_StocktakingBill = @StocktakingBillNo
  645. SELECT @ID_StocktakingBill = StocktakingBill.ID_StocktakingBill FROM StocktakingBill WHERE StocktakingBill.No_StocktakingBill = @StocktakingBillNo
  646. SELECT StocktakingBillProduct.*,convert(decimal(14,2),Quantity_StocktakingBillProduct - StockQty_StocktakingBillProduct) as Account,
  647. Product.No_Product,Product.Name_Product,Product.Unit_Product,
  648. Location.No_Location, Location.Name_Location,Location.ID_Location,@StocktakingBillNo as No_StocktakingBill
  649. FROM StocktakingBillProduct
  650. LEFT JOIN Product ON Product.ID_Product = StocktakingBillProduct.ID_Product
  651. LEFT JOIN Location ON Location.ID_Location = StocktakingBillProduct.ID_Location
  652. WHERE StocktakingBillProduct.ID_StocktakingBill=@ID_StocktakingBill
  653. order by CAST(No_StocktakingBillProduct AS INT)">
  654. <Params>
  655. <Param name="@No_StocktakingBill" type="StocktakingBill.No_StocktakingBill" Index="0" />
  656. </Params>
  657. <Tables>
  658. <Table name="StocktakingBill" />
  659. <Table name="StocktakingBillProduct" />
  660. </Tables>
  661. </SearchStocktakingBillNext>
  662. <SearchStocktakingBillLast CmdType="Text" CmdText="DECLARE @StocktakingBillNo nvarchar(64)
  663. SELECT TOP 1 @StocktakingBillNo = StocktakingBill.No_StocktakingBill FROM StocktakingBill ORDER BY StocktakingBill.No_StocktakingBill DESC
  664. DECLARE @ID_StocktakingBill uniqueidentifier
  665. SELECT StocktakingBill.*,a.Name_User AS Name_Creator, b.Name_User AS Name_Assessor, c.Name_User AS LastModUserName,
  666. Location.No_Location, Location.Name_Location
  667. FROM StocktakingBill
  668. LEFT JOIN AppUser a ON a.ID_User = StocktakingBill.ID_Creator
  669. LEFT JOIN AppUser b ON b.ID_User = StocktakingBill.ID_Assessor
  670. LEFT JOIN AppUser c ON c.ID_User = StocktakingBill.LastModUser_StocktakingBill
  671. LEFT JOIN Location ON Location.ID_Location = StocktakingBill.ID_Location
  672. WHERE StocktakingBill.No_StocktakingBill = @StocktakingBillNo
  673. SELECT @ID_StocktakingBill = StocktakingBill.ID_StocktakingBill FROM StocktakingBill WHERE StocktakingBill.No_StocktakingBill = @StocktakingBillNo
  674. SELECT StocktakingBillProduct.*,convert(decimal(14,2),Quantity_StocktakingBillProduct - StockQty_StocktakingBillProduct) as Account,
  675. Product.No_Product,Product.Name_Product,Product.Unit_Product,
  676. Location.No_Location, Location.Name_Location,Location.ID_Location,@StocktakingBillNo as No_StocktakingBill
  677. FROM StocktakingBillProduct
  678. LEFT JOIN Product ON Product.ID_Product = StocktakingBillProduct.ID_Product
  679. LEFT JOIN Location ON Location.ID_Location = StocktakingBillProduct.ID_Location
  680. WHERE StocktakingBillProduct.ID_StocktakingBill=@ID_StocktakingBill
  681. order by CAST(No_StocktakingBillProduct AS INT)">
  682. <Tables>
  683. <Table name="StocktakingBill" />
  684. <Table name="StocktakingBillProduct" />
  685. </Tables>
  686. </SearchStocktakingBillLast>
  687. <SearchAllProduct CmdType="Text" CmdText="SELECT Product.No_Product,Product.Name_Product,Product.Type_Product,B.Name_Location,Product.Unit_Product,Product.SuspendDate_Product, case isnull(Product.SuspendDate_Product,0) when 0 then '否' else '是' end as Suspend FROM Product
  688. LEFT JOIN ProductStocks ON ProductStocks.ID_Product = Product.ID_Product
  689. LEFT JOIN Location B ON ProductStocks.ID_Location = B.ID_Location
  690. ">
  691. <Tables>
  692. <Table name="AllProduct" />
  693. </Tables>
  694. </SearchAllProduct>
  695. <SearchJudgeLocationAndWarehouse CmdType="Text" CmdText="SELECT Name_Location,ID_Location FROM Location WHERE ID_Warehouse=@ID_Warehouse AND ID_Location=@ID_Location and LowestLevel_Location=1">
  696. <Params>
  697. <Param name="@ID_Warehouse" type="Location.ID_Warehouse" Index="0" />
  698. <Param name="@ID_Location" type="Location.ID_Location" Index="1" />
  699. </Params>
  700. <Tables>
  701. <Table name="JudgeLocationAndWarehouse" />
  702. </Tables>
  703. </SearchJudgeLocationAndWarehouse>
  704. <SearchStockQty CmdType="Text" CmdText=" SELECT StockQty_ProductStocks FROM ProductStocks
  705. WHERE ProductStocks.ID_Product=@ID_Product AND ProductStocks.ID_Location=@ID_Location">
  706. <Params>
  707. <Param name="@ID_Product" type="Product.ID_Product" Index="0" />
  708. <Param name="@ID_Location" type="Product.ID_Location" Index="1" />
  709. </Params>
  710. <Tables>
  711. <Table name="StockQty" />
  712. </Tables>
  713. </SearchStockQty>
  714. <SearchOneLocation CmdType="" CmdText="Select Top 1 B.ID_Location,B.No_Location,B.Name_Location From Location B
  715. inner join Location C on B.ID_Warehouse = C.ID_Location
  716. Left Join ProductStocks On ProductStocks.ID_Location = B.ID_Location
  717. Left Join Product On Product.ID_Product = ProductStocks.ID_Product
  718. Where C.Name_Location = @Name_Location And B.LowestLevel_Location =1 And No_Product= @No_Product
  719. And Mark_ProductStocks = 1
  720. Order By B.No_Location">
  721. <Params>
  722. <Param name="@No_Product" type="Product.No_Product" Index="0" />
  723. <Param name="@Name_Location" type="Location.Name_Location" Index="1" />
  724. </Params>
  725. <Tables>
  726. <Table name="OneLocation" />
  727. </Tables>
  728. </SearchOneLocation>
  729. </Search>
  730. </Server>
  731. <Lables>
  732. <Search>
  733. Empty();
  734. NewInstance();
  735. timeMake.Enabled =false;
  736. txtComment.ReadOnly =true;
  737. tbNo.ReadOnly =false;
  738. cbLocation.Enabled =false;
  739. dgProduct.ReadOnly =true;
  740. toolBar.EnableSubmit =false;
  741. toolBar.EnableModify =false;
  742. toolBar.EnableDelete =false;
  743. toolBar.EnableAudit =false;
  744. toolBar.EnableUnAudit =false;
  745. toolBar.EnableNew =GetRight(@Title,"新增");
  746. toolBar.EnablePrint =false;
  747. toolBar.EnableExport = false;
  748. #StocktakingBill.AssessDate_StocktakingBill =DBNull();
  749. #StocktakingBill.ID_Assessor =DBNull();
  750. #StocktakingBill.ID_Creator =DBNull();
  751. #StocktakingBill.LastModUser_StocktakingBill =DBNull();
  752. #StocktakingBill.LastModDate_StocktakingBill =DBNull();
  753. UpdateForm(true,"");
  754. tbNo.Focus();
  755. @Status=0;
  756. </Search>
  757. <New>
  758. Empty();
  759. NewInstance();
  760. timeMake.Enabled =true;
  761. txtComment.ReadOnly =false;
  762. tbNo.ReadOnly =true;
  763. cbLocation.Enabled =true;
  764. dgProduct.ReadOnly =false;
  765. toolBar.EnableSubmit =GetRight(@Title,"新增");
  766. toolBar.EnableModify =false;
  767. toolBar.EnableDelete =false;
  768. toolBar.EnableAudit =false;
  769. toolBar.EnableUnAudit =false;
  770. toolBar.EnableNew =false;
  771. toolBar.EnablePrint =false;
  772. toolBar.EnableExport = false;
  773. #StocktakingBill.ID_StocktakingBill =NewGuid();
  774. #StocktakingBill.ID_Creator =GetLoginUserID();
  775. #StocktakingBill.Name_Creator =GetCurrentUser();
  776. #StocktakingBill.AssessDate_StocktakingBill =DBNull();
  777. #StocktakingBill.ID_Assessor =DBNull();
  778. #StocktakingBill.LastModUser_StocktakingBill =DBNull();
  779. #StocktakingBill.LastModUserName =DBNull();
  780. #StocktakingBill.LastModDate_StocktakingBill =DBNull();
  781. #StocktakingBill.ID_Location =GetCurrentDepotID();
  782. #StocktakingBill.Name_Location =GetCurrentDepot();
  783. #StocktakingBill.No_Location =GetCurrentDepotNo();
  784. #StocktakingBill.Date_StocktakingBill =GetCurrentTime();
  785. UpdateForm(true,"");
  786. timeMake.Focus();
  787. @Status=1;
  788. </New>
  789. <View>
  790. timeMake.Enabled =false;
  791. txtComment.ReadOnly =true;
  792. tbNo.ReadOnly =false;
  793. cbLocation.Enabled =false;
  794. dgProduct.ReadOnly =true;
  795. toolBar.EnableSubmit =false;
  796. toolBar.EnableNew =GetRight(@Title,"新增");
  797. if(Equals(#StocktakingBill.ID_Assessor, DBNull()))
  798. {
  799. toolBar.EnableUnAudit=false;
  800. toolBar.EnableAudit=GetRight(@Title,"审核");
  801. toolBar.EnableModify=GetRight(@Title,"修改");
  802. toolBar.EnableDelete=GetRight(@Title,"删除");
  803. }
  804. else
  805. {
  806. toolBar.EnableAudit=false;
  807. toolBar.EnableUnAudit=GetRight(@Title,"取消审核");
  808. toolBar.EnableDelete=false;
  809. toolBar.EnableModify=false;
  810. }
  811. toolBar.EnablePrint =GetRight(@Title,"打印");
  812. toolBar.EnableExport = true;
  813. UpdateForm(true, "");
  814. @Status=2;
  815. </View>
  816. <Modify>
  817. timeMake.Enabled =false;
  818. txtComment.ReadOnly =false;
  819. tbNo.ReadOnly =true;
  820. dgProduct.ReadOnly =false;
  821. cbLocation.Enabled =true;
  822. toolBar.EnableSubmit =GetRight(@Title,"修改");
  823. toolBar.EnableModify =false;
  824. toolBar.EnableDelete =false;
  825. toolBar.EnableAudit =false;
  826. toolBar.EnableUnAudit =false;
  827. toolBar.EnableNew =false;
  828. toolBar.EnablePrint =false;
  829. toolBar.EnableExport = false;
  830. #StocktakingBill.LastModUser_StocktakingBill =GetLoginUserID();
  831. #StocktakingBill.LastModUserName =GetCurrentUser();
  832. #StocktakingBill.LastModDate_StocktakingBill =DateTimeNow();
  833. UpdateForm(true, "");
  834. @Status=3;
  835. </Modify>
  836. <SubmitButtonClick>
  837. <![CDATA[
  838. if (!cbLocation.CheckSelectedItem())
  839. {
  840. MessageBox("请选择有效的盘点仓库!",@Title);
  841. cbLocation.Focus();
  842. return;
  843. }
  844. if(RowCount("#StocktakingBillProduct")==0)
  845. {
  846. MessageBox("请输入盘点产品!",@Title);
  847. dgProduct.Focus();
  848. return;
  849. }
  850. UpdateForm(false, "");
  851. SuspendLayout();
  852. for (@i=0;@i<=RowCount("#StocktakingBillProduct")-1;@i=@i+1)
  853. {
  854. SetPosition("#StocktakingBillProduct", @i);
  855. if (Equals(#StocktakingBillProduct.No_Product,""))
  856. {
  857. dgProduct.CurrentRowIndex = @i;
  858. MessageBox("请输入产品编号!",@Title);
  859. dgProduct.Focus();
  860. ResumeLayout();
  861. return;
  862. }
  863. if(Equals(#StocktakingBillProduct.ID_Product,GuidEmpty()))
  864. {
  865. dgProduct.CurrentRowIndex = @i;
  866. MessageBox("该产品不存在!",@Title);
  867. dgProduct.Focus();
  868. ResumeLayout();
  869. return;
  870. }
  871. if(Equals(#StocktakingBillProduct.ID_Location,DBNull()) || Equals(#StocktakingBillProduct.ID_Location,GuidEmpty()))
  872. {
  873. dgProduct.CurrentRowIndex = @i;
  874. MessageBox("请选择有效的库位!",@Title);
  875. dgProduct.Focus();
  876. ResumeLayout();
  877. return;
  878. }
  879. if(!Search("SearchJudgeLocationAndWarehouse",#StocktakingBill.ID_Location,#StocktakingBillProduct.ID_Location))
  880. {
  881. dgProduct.CurrentRowIndex = @i;
  882. MessageBox("该库位不属于所选仓库,请重新选择!",@Title);
  883. dgProduct.Focus();
  884. ResumeLayout();
  885. return;
  886. }
  887. if (Equals(#StocktakingBillProduct.ID_StocktakingBillProduct,GuidEmpty()))
  888. {
  889. #StocktakingBillProduct.ID_StocktakingBillProduct = NewGuid();
  890. }
  891. #StocktakingBillProduct.ID_StocktakingBill=#StocktakingBill.ID_StocktakingBill;
  892. }
  893. ResumeLayout();
  894. if(@Status == 1)
  895. {
  896. #StocktakingBill.CreateDate_StocktakingBill=DateTimeNow();
  897. #StocktakingBill.No_StocktakingBill = New("#StocktakingBill.No_StocktakingBill", timeMake.CValue);
  898. }
  899. else if(@Status == 3)
  900. {
  901. #StocktakingBill.LastModDate_StocktakingBill =DateTimeNow();
  902. Update();
  903. }
  904. ChangeMode("View");
  905. ]]>
  906. </SubmitButtonClick>
  907. </Lables>
  908. </Form>
  909. </Forms>