FrmLocation.xml 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606
  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <Forms>
  3. <Form Name="FrmLocation">
  4. <Client>
  5. <Events>
  6. <Load>
  7. <![CDATA[
  8. @Title="仓库库位设置";
  9. GetSchema();
  10. ]]>
  11. </Load>
  12. <EndLoad>
  13. <![CDATA[
  14. ChangeMode("Search");
  15. ]]>
  16. </EndLoad>
  17. <Closing>
  18. ;
  19. </Closing>
  20. <Closed>
  21. ;
  22. </Closed>
  23. </Events>
  24. <Mode>
  25. <Search>
  26. <Lable name="Search" />
  27. </Search>
  28. <New>
  29. <Lable name="New" />
  30. </New>
  31. <View>
  32. <Lable name="View" />
  33. </View>
  34. <Modify>
  35. <Lable name="Modify" />
  36. </Modify>
  37. </Mode>
  38. <Controls>
  39. <IKTextButton name="tbNo" DataSource="Location.No_Location">
  40. <Events>
  41. <Enter>
  42. <![CDATA[
  43. if(tbNo.ReadOnly == false)
  44. {
  45. if(tbNo.CValue != StringEmpty())
  46. {
  47. UpdateForm(false, "");
  48. if(Search("SearchLocationWithNo", tbNo.CValue))
  49. {
  50. ChangeMode("View");
  51. }
  52. else
  53. {
  54. if(GetRight(@Title,"新增"))
  55. ChangeMode("New");
  56. else
  57. MessageBox("您没有新增仓库库位设置的权限!",@Title);
  58. }
  59. }
  60. else
  61. {
  62. MessageBox("请输入库位编号!",@Title);
  63. }
  64. }
  65. ]]>
  66. </Enter>
  67. <Click>
  68. @Temp = ShowSearchBox("LocationSearch","INFOMATION");
  69. if(@Temp != StringEmpty())
  70. {
  71. tbNo.CValue = @Temp;
  72. UpdateForm(false, "");
  73. if(Search("SearchLocationWithNo", tbNo.CValue))
  74. {
  75. ChangeMode("View");
  76. }
  77. }
  78. </Click>
  79. </Events>
  80. </IKTextButton>
  81. <IKTextBox name="txtName" DataSource="Location.Name_Location"/>
  82. <IKComboBoxEx name="cbSubjection" ValueSource="Location.SubjectionID_Location" DisplaySource="Location.SubDepot" NoSource="Location.No_SubLocation"
  83. DataSource="AllLocation" ValueMember="ID_Location" DisplayMember="Name_Location" NoMember="No_Location">
  84. <Events>
  85. <Reload>
  86. UpdateForm(false, "cbSubjection");
  87. Search("SearchAllLocation");
  88. UpdateForm(true, "cbSubjection");
  89. </Reload>
  90. </Events>
  91. </IKComboBoxEx>
  92. <IKTextBox name="txtCreator" DataSource="Location.CreateName"/><!--Declare-->
  93. <IKDateTimeText name="dttCreateDate" DataSource="Location.CreateDate_Location"/>
  94. <IKTextBox name="txtComment" DataSource="Location.Comment_Location"/>
  95. <IKTextBox name="txtMender" DataSource="Location.LastModUser_LocationName"></IKTextBox>
  96. <IKDateTimeText name="dttMendeDate" DataSource="Location.LastModDate_Location"></IKDateTimeText>
  97. <IKFormToolBar name="toolBar">
  98. <Events>
  99. <ClickFirst>
  100. if(Search("SearchLocationFirst", tbNo.CValue))
  101. {
  102. ChangeMode("View");
  103. }
  104. </ClickFirst>
  105. <ClickPrev>
  106. if(Search("SearchLocationPrevious", tbNo.CValue))
  107. {
  108. ChangeMode("View");
  109. }
  110. </ClickPrev>
  111. <ClickNext>
  112. if(Search("SearchLocationNext", tbNo.CValue))
  113. {
  114. ChangeMode("View");
  115. }
  116. </ClickNext>
  117. <ClickLast>
  118. if(Search("SearchLocationLast", tbNo.CValue))
  119. {
  120. ChangeMode("View");
  121. }
  122. </ClickLast>
  123. <ClickNew>
  124. ;
  125. </ClickNew>
  126. <ClickEmpty>
  127. ChangeMode("Search");
  128. </ClickEmpty>
  129. <ClickSubmit>
  130. <Lable name="SubmitButtonClick" />
  131. </ClickSubmit>
  132. <ClickModify>
  133. ChangeMode("Modify");
  134. </ClickModify>
  135. <ClickDelete>
  136. if(Search("SearchSubLocation", tbNo.CValue))
  137. {
  138. if(MessageBox("该库位有下属库位,若删除此库位资料其所有下属库位的资料均会被删除,确定要删除此库位资料吗?",@Title,MB_YESNO)==DialogResult("YES"))
  139. {
  140. Delete(); ChangeMode("Search");
  141. }
  142. }
  143. else
  144. {
  145. Delete(); ChangeMode("Search");
  146. }
  147. </ClickDelete>
  148. <ClickPrint>
  149. PrintReport();
  150. </ClickPrint>
  151. <ClickAudit>
  152. ;
  153. </ClickAudit>
  154. <ClickUnAudit>
  155. ;
  156. </ClickUnAudit>
  157. <ClickImport>
  158. ;
  159. </ClickImport>
  160. <ClickExport>
  161. ;
  162. </ClickExport>
  163. <ClickClose>
  164. ;
  165. </ClickClose>
  166. <ClickExpand>
  167. if(toolBar.ExpandForm==true)
  168. {
  169. pnRight.Visible=true;<!--PanelRight is not existed-->
  170. }
  171. else
  172. {
  173. pnRight.Visible=false;
  174. }
  175. </ClickExpand>
  176. </Events>
  177. </IKFormToolBar>
  178. <IKHiberaTree name="LocationTree" DisplayMember="Name_Location" ValueMember="ID_Location" NoMember="No_Location" SubjectValueMember="SubjectionID_Location" DataSource="treeDep">
  179. <Events>
  180. <DoubleClick>
  181. if( !Equals(LocationTree.SelectNodeNo, tbNo.CValue) )
  182. {
  183. ChangeMode("Search");
  184. tbNo.CValue = LocationTree.SelectNodeNo;
  185. ActiveControlEvent("tbNo", "Enter");
  186. }
  187. </DoubleClick>
  188. <RightClickItem>
  189. ;
  190. </RightClickItem>
  191. </Events>
  192. </IKHiberaTree>
  193. </Controls>
  194. <Tables>
  195. ;<!--TODO-->
  196. </Tables>
  197. <LockInfomation LockID="ID_Location" LockNO="No_Location" LockSearchFunction="SearchLocationWithNo"/>
  198. <ChildForms>
  199. <ChildForm name="LocationSearch" DataSource="Location" SearchFunction="SearchAllLocationofsub" SearchFunctionByNo="SearchLocationWithNo" MappingName="仓库">
  200. <DataColumn Index="0" MappingName="#Location.No_Location" HeaderText="仓库编号" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  201. <DataColumn Index="1" MappingName="#Location.Name_Location" HeaderText="仓库名称" Width="90" ColumnType="IKDataGridTextBoxColumn"/>
  202. </ChildForm>
  203. </ChildForms>
  204. </Client>
  205. <Server>
  206. <Tables>
  207. <Table name="Location" Type="Parent">
  208. <GetSchema CmdType="Text" CmdText=" SELECT TOP 0 A.*,B.Name_Location AS SubDepot,Y.Name_User as LastModUser_LocationName, B.No_Location as No_SubLocation,U.Name_User AS CreateName FROM Location A
  209. LEFT JOIN Location B ON A.SubjectionID_Location = B.ID_Location
  210. LEFT JOIN AppUser U ON A.ID_Creator = U.ID_User
  211. LEFT JOIN AppUser Y ON A.LastModUser_Location = Y.ID_User">
  212. </GetSchema>
  213. <New CmdType="Text" CmdText="
  214. IF(Exists(SELECT * FROM Location WHERE ID_Location=@SubjectionID_Location))
  215. BEGIN
  216. SELECT @ID_Warehouse=ID_Warehouse, @Level_Location=Level_Location+1 FROM Location WHERE ID_Location=@SubjectionID_Location
  217. END
  218. ELSE
  219. BEGIN
  220. SET @ID_Warehouse=@ID_Location
  221. SET @Level_Location=0
  222. END
  223. DECLARE @LocationLevel_SystemSetting INT
  224. SELECT @LocationLevel_SystemSetting=LocationLevel_SystemSetting FROM SystemSetting
  225. IF(@LocationLevel_SystemSetting=@Level_Location)
  226. SET @LowestLevel_Location=1
  227. ELSE
  228. SET @LowestLevel_Location=0
  229. INSERT INTO Location (ID_Location, No_Location, Name_Location, SubjectionID_Location, Level_Location, LowestLevel_Location, ID_Creator, CreateDate_Location, Comment_Location, SuspendDate_Location, ID_Warehouse,LastModUser_Location,LastModDate_Location)
  230. VALUES(@ID_Location, @No_Location, @Name_Location, @SubjectionID_Location, @Level_Location, @LowestLevel_Location, @ID_Creator, @CreateDate_Location, @Comment_Location, @SuspendDate_Location, @ID_Warehouse,@LastModUser_Location,@LastModDate_Location)">
  231. <Params>
  232. <Param name="@ID_Location" type="Location.ID_Location" sourceColumn="ID_Location" />
  233. <Param name="@No_Location" type="Location.No_Location" sourceColumn="No_Location" />
  234. <Param name="@Name_Location" type="Location.Name_Location" sourceColumn="Name_Location" />
  235. <Param name="@SubjectionID_Location" type="Location.SubjectionID_Location" sourceColumn="SubjectionID_Location" />
  236. <Param name="@Level_Location" type="Location.Level_Location" sourceColumn="Level_Location" />
  237. <Param name="@LowestLevel_Location" type="Location.LowestLevel_Location" sourceColumn="LowestLevel_Location" />
  238. <Param name="@ID_Creator" type="Location.ID_Creator" sourceColumn="ID_Creator" />
  239. <Param name="@CreateDate_Location" type="Location.CreateDate_Location" sourceColumn="CreateDate_Location" />
  240. <Param name="@Comment_Location" type="Location.Comment_Location" sourceColumn="Comment_Location" />
  241. <Param name="@SuspendDate_Location" type="Location.SuspendDate_Location" sourceColumn="SuspendDate_Location" />
  242. <Param name="@ID_Warehouse" type="Location.ID_Warehouse" sourceColumn="ID_Warehouse" />
  243. <Param name="@LastModUser_Location" type="Location.LastModUser_Location" sourceColumn="LastModUser_Location" />
  244. <Param name="@LastModDate_Location" type="Location.LastModDate_Location" sourceColumn="LastModDate_Location" />
  245. </Params>
  246. </New>
  247. <Update CmdType="Text" CmdText="UPDATE Location SET
  248. Name_Location=@Name_Location,
  249. ID_Creator=@ID_Creator,
  250. CreateDate_Location=@CreateDate_Location,
  251. Comment_Location=@Comment_Location,
  252. SuspendDate_Location=@SuspendDate_Location,
  253. ID_Warehouse=@ID_Warehouse,
  254. LastModDate_Location=@LastModDate_Location,
  255. LastModUser_Location=@LastModUser_Location
  256. WHERE ID_Location=@ID_Location">
  257. <Params>
  258. <Param name="@ID_Location" type="Location.ID_Location" sourceColumn="ID_Location" />
  259. <Param name="@Name_Location" type="Location.Name_Location" sourceColumn="Name_Location" />
  260. <Param name="@ID_Creator" type="Location.ID_Creator" sourceColumn="ID_Creator" />
  261. <Param name="@CreateDate_Location" type="Location.CreateDate_Location" sourceColumn="CreateDate_Location" />
  262. <Param name="@Comment_Location" type="Location.Comment_Location" sourceColumn="Comment_Location" />
  263. <Param name="@SuspendDate_Location" type="Location.SuspendDate_Location" sourceColumn="SuspendDate_Location" />
  264. <Param name="@ID_Warehouse" type="Location.ID_Warehouse" sourceColumn="ID_Warehouse" />
  265. <Param name="@LastModDate_Location" type="Location.LastModDate_Location" sourceColumn="LastModDate_Location" />
  266. <Param name="@LastModUser_Location" type="Location.LastModUser_Location" sourceColumn="LastModUser_Location" />
  267. </Params>
  268. </Update>
  269. <Delete CmdType="Text" CmdText="IF Object_ID(N'tempdb..#DELETE') IS Not NULL
  270. DROP TABLE #DELETE
  271. CREATE TABLE #DELETE
  272. (
  273. ID_DELETE UNIQUEIDENTIFIER,
  274. LEV_DELETE INT
  275. )
  276. DECLARE @ID_LOC UNIQUEIDENTIFIER
  277. DECLARE @LEV INT
  278. DECLARE @TEMPLEV INT
  279. DECLARE @STR NVARCHAR(100)
  280. DECLARE @COUNTS INT
  281. DECLARE @COUNT INT
  282. SELECT @ID_LOC = A.ID_LOCATION,@LEV = A.LEVEL_LOCATION FROM LOCATION A
  283. LEFT JOIN LOCATION B ON A.ID_LOCATION = B.SUBJECTIONID_LOCATION
  284. WHERE A.ID_LOCATION = @ID_Location
  285. SET @STR = N'INSERT INTO #DELETE VALUES(@TID_LOC,@TLEV)'
  286. EXECUTE sp_executesql @STR,N'@TID_LOC UNIQUEIDENTIFIER,@TLEV INT',@ID_LOC,@LEV
  287. DECLARE CUR CURSOR FOR SELECT B.ID_LOCATION ,B.LEVEL_LOCATION FROM LOCATION A
  288. INNER JOIN LOCATION B ON A.ID_LOCATION = B.SUBJECTIONID_LOCATION
  289. WHERE A.ID_LOCATION = @ID_Location
  290. OPEN CUR
  291. FETCH NEXT FROM CUR INTO @ID_LOC,@LEV
  292. WHILE @@FETCH_STATUS = 0
  293. BEGIN
  294. SET @STR = N'INSERT INTO #DELETE VALUES(@TID_LOC,@TLEV)'
  295. EXECUTE sp_executesql @STR,N'@TID_LOC UNIQUEIDENTIFIER,@TLEV INT',@ID_LOC,@LEV
  296. FETCH NEXT FROM CUR INTO @ID_LOC,@LEV
  297. END
  298. CLOSE CUR
  299. DEALLOCATE CUR
  300. SET @TEMPLEV = @LEV
  301. SELECT @COUNTS = COUNT(*) FROM (SELECT * FROM #DELETE WHERE LEV_DELETE = @TEMPLEV) COUNTS
  302. WHILE @COUNTS &gt; 0
  303. BEGIN
  304. DECLARE CUR CURSOR FOR SELECT L.ID_LOCATION,L.LEVEL_LOCATION FROM #DELETE T
  305. INNER JOIN LOCATION L ON T.ID_DELETE = L.SUBJECTIONID_LOCATION
  306. WHERE T.LEV_DELETE = @TEMPLEV
  307. OPEN CUR
  308. FETCH NEXT FROM CUR INTO @ID_LOC,@LEV
  309. WHILE @@FETCH_STATUS = 0
  310. BEGIN
  311. SET @STR = N'INSERT INTO #DELETE VALUES(@TID_LOC,@TLEV)'
  312. EXECUTE sp_executesql @STR,N'@TID_LOC UNIQUEIDENTIFIER,@TLEV INT',@ID_LOC,@LEV
  313. FETCH NEXT FROM CUR INTO @ID_LOC,@LEV
  314. END
  315. CLOSE CUR
  316. DEALLOCATE CUR
  317. SET @TEMPLEV = @TEMPLEV + 1
  318. SELECT @COUNTS = COUNT(*) FROM (SELECT * FROM #DELETE WHERE LEV_DELETE = @TEMPLEV) COUNTS
  319. END
  320. SELECT @COUNTS = COUNT(*) FROM #DELETE
  321. DECLARE CUR CURSOR FOR SELECT ID_DELETE FROM #DELETE ORDER BY LEV_DELETE DESC
  322. OPEN CUR
  323. FETCH NEXT FROM CUR INTO @ID_LOC
  324. WHILE @@FETCH_STATUS = 0
  325. BEGIN
  326. IF @COUNTS != 1
  327. BEGIN
  328. SELECT @COUNT=COUNT(*) FROM LockInfoTable WHERE LockInfoTable.RecordID_LockInfoTable = @ID_LOC
  329. IF @COUNT != 0
  330. BEGIN
  331. CLOSE CUR
  332. DEALLOCATE CUR
  333. DROP TABLE #DELETE
  334. RAISERROR('子库位正在被使用,无法执行删除操作!',18,1)
  335. RETURN
  336. END
  337. INSERT INTO LockInfoTable (RecordID_LockInfoTable,Funcode_LockInfoTable,LoginID_LockInfoTable,UserID_LockInfoTable) VALUES (@ID_LOC,'FrmLocation',NEWID(),NEWID())
  338. SET @COUNTS = @COUNTS-1
  339. END
  340. DECLARE @COU DEC(14,4) SELECT @COU = sum(isnull(AvailableQty_ProductStocks,0)) FROM ProductStocks
  341. WHERE ProductStocks.ID_Location=@ID_LOC
  342. IF @COU &gt; 0
  343. BEGIN
  344. CLOSE CUR
  345. DEALLOCATE CUR
  346. DROP TABLE #DELETE
  347. RAISERROR('该库位已存在库存,无法删除!',18,19)
  348. RETURN
  349. END
  350. DELETE FROM ProductStocks WHERE ProductStocks.ID_Location=@ID_LOC
  351. DELETE FROM LOCATION WHERE LOCATION.ID_LOCATION = @ID_LOC
  352. DELETE FROM LockInfoTable WHERE LockInfoTable.RecordID_LockInfoTable = @ID_LOC AND LockInfoTable.Funcode_LockInfoTable = 'FrmLocation'
  353. FETCH NEXT FROM CUR INTO @ID_LOC
  354. END
  355. CLOSE CUR
  356. DEALLOCATE CUR
  357. DROP TABLE #DELETE">
  358. <Params>
  359. <Param name="@ID_Location" type="Location.ID_Location" sourceColumn="ID_Location" />
  360. </Params>
  361. </Delete>
  362. <FKErrorReport ErrorMessage="该库位已被引用,删除失败!"/>
  363. <UNIQUEErrorReport ErrorMessage="该库位编号或名称已存在,提交失败!"/>
  364. </Table>
  365. </Tables>
  366. <Search>
  367. <SearchAllLocationofsub CmdType="Text" CmdText="SELECT Location.No_Location,Location.Name_Location FROM Location ">
  368. <Tables>
  369. <Table name="Alldepartment" />
  370. </Tables>
  371. </SearchAllLocationofsub>
  372. <SearchTree CmdType="Text" CmdText="Select ID_Location,No_Location,'('+No_Location+')'+Name_Location As Name_Location, SubjectionID_Location From Location">
  373. <Tables>
  374. <Table name="treeDep" />
  375. </Tables>
  376. </SearchTree>
  377. <SearchLocationWithNo CmdType="Text" CmdText=" SELECT A.*,B.Name_Location AS SubDepot,Y.Name_User as LastModUser_LocationName, B.No_Location as No_SubLocation,U.Name_User AS CreateName FROM Location A
  378. LEFT JOIN Location B ON A.SubjectionID_Location = B.ID_Location
  379. LEFT JOIN AppUser U ON A.ID_Creator = U.ID_User
  380. LEFT JOIN AppUser Y ON A.LastModUser_Location = Y.ID_User
  381. WHERE A.No_Location = @No_Location">
  382. <Params>
  383. <Param name="@No_Location" type="Location.No_Location" sourceColumn="No_Location" />
  384. </Params>
  385. <Tables>
  386. <Table name="Location" />
  387. </Tables>
  388. </SearchLocationWithNo>
  389. <SearchAllLocation CmdType="Text" CmdText="SELECT A.ID_Location,A.Name_Location,A.No_Location FROM Location A order by No_Location ">
  390. <Tables>
  391. <Table name="AllLocation"/>
  392. </Tables>
  393. </SearchAllLocation>
  394. <SearchCurrentLocationLevel CmdType="Text" CmdText="SELECT Level_Location FROM Location Where Location.ID_Location = @ID_Location">
  395. <Params>
  396. <Param name="@ID_Location" type="Location.ID_Location" sourceColumn="ID_Location" />
  397. </Params>
  398. <Tables>
  399. <Table name="LocationLevel"/>
  400. </Tables>
  401. </SearchCurrentLocationLevel>
  402. <SearchLocationLevel CmdType="Text" CmdText="SELECT LocationLevel_SystemSetting FROM SystemSetting">
  403. <Tables>
  404. <Table name="SystemSetting"/>
  405. </Tables>
  406. </SearchLocationLevel>
  407. <SearchLocationFirst CmdType="Text" CmdText=" DECLARE @NextNo nvarchar(64)
  408. SET @NextNo = @No_Location
  409. SELECT TOP 1 @NextNo = Location.No_Location FROM Location ORDER BY Location.No_Location
  410. SELECT A.*,B.Name_Location AS SubDepot,Y.Name_User as LastModUser_LocationName, B.No_Location as No_SubLocation,U.Name_User AS CreateName FROM Location A
  411. LEFT JOIN Location B ON A.SubjectionID_Location = B.ID_Location
  412. LEFT JOIN AppUser U ON A.ID_Creator = U.ID_User
  413. LEFT JOIN AppUser Y ON A.LastModUser_Location = Y.ID_User
  414. WHERE A.No_Location = @NextNo">
  415. <Params>
  416. <Param name="@No_Location" type="Location.No_Location" sourceColumn="No_Location" />
  417. </Params>
  418. <Tables>
  419. <Table name="Location" />
  420. </Tables>
  421. </SearchLocationFirst>
  422. <SearchLocationPrevious CmdType="Text" CmdText="DECLARE @NextNo nvarchar(64)
  423. SET @NextNo = @No_Location
  424. SELECT TOP 1 @NextNo = Location.No_Location FROM Location WHERE Location.No_Location &lt; @No_Location ORDER BY Location.No_Location Desc
  425. SELECT A.*,B.Name_Location AS SubDepot,Y.Name_User as LastModUser_LocationName, B.No_Location as No_SubLocation,U.Name_User AS CreateName FROM Location A
  426. LEFT JOIN Location B ON A.SubjectionID_Location = B.ID_Location
  427. LEFT JOIN AppUser U ON A.ID_Creator = U.ID_User
  428. LEFT JOIN AppUser Y ON A.LastModUser_Location = Y.ID_User
  429. WHERE A.No_Location = @NextNo">
  430. <Params>
  431. <Param name="@No_Location" type="Location.No_Location" sourceColumn="No_Location" />
  432. </Params>
  433. <Tables>
  434. <Table name="Location" />
  435. </Tables>
  436. </SearchLocationPrevious>
  437. <SearchLocationNext CmdType="Text" CmdText=" DECLARE @NextNo nvarchar(64)
  438. SET @NextNo = @No_Location
  439. SELECT TOP 1 @NextNo = Location.No_Location FROM Location WHERE Location.No_Location &gt; @No_Location ORDER BY Location.No_Location
  440. SELECT A.*,B.Name_Location AS SubDepot,Y.Name_User as LastModUser_LocationName, B.No_Location as No_SubLocation,U.Name_User AS CreateName FROM Location A
  441. LEFT JOIN Location B ON A.SubjectionID_Location = B.ID_Location
  442. LEFT JOIN AppUser U ON A.ID_Creator = U.ID_User
  443. LEFT JOIN AppUser Y ON A.LastModUser_Location = Y.ID_User
  444. WHERE A.No_Location = @NextNo">
  445. <Params>
  446. <Param name="@No_Location" type="Location.No_Location" sourceColumn="No_Location" />
  447. </Params>
  448. <Tables>
  449. <Table name="Location" />
  450. </Tables>
  451. </SearchLocationNext>
  452. <SearchLocationLast CmdType="Text" CmdText=" DECLARE @NextNo nvarchar(64)
  453. SET @NextNo = @No_Location
  454. SELECT TOP 1 @NextNo = Location.No_Location FROM Location ORDER BY Location.No_Location DESC
  455. SELECT A.*,B.Name_Location AS SubDepot,Y.Name_User as LastModUser_LocationName, B.No_Location as No_SubLocation,U.Name_User AS CreateName FROM Location A
  456. LEFT JOIN Location B ON A.SubjectionID_Location = B.ID_Location
  457. LEFT JOIN AppUser U ON A.ID_Creator = U.ID_User
  458. LEFT JOIN AppUser Y ON A.LastModUser_Location = Y.ID_User
  459. WHERE A.No_Location = @NextNo">
  460. <Params>
  461. <Param name="@No_Location" type="Location.No_Location" sourceColumn="No_Location" />
  462. </Params>
  463. <Tables>
  464. <Table name="Location" />
  465. </Tables>
  466. </SearchLocationLast>
  467. <SearchSubLocation CmdType="Text" CmdText="SELECT * FROM location A
  468. INNER JOIN Location B ON A.ID_Location = B.SubjectionID_Location
  469. WHERE A.No_Location = @No_Location">
  470. <Params>
  471. <Param name="@No_Location" type="Location.No_Location" sourceColumn="No_Location" />
  472. </Params>
  473. <Tables>
  474. <Table name="LocationSub" />
  475. </Tables>
  476. </SearchSubLocation>
  477. <SearchLevelByName CmdType="Text" CmdText="SELECT Level_Location,ID_Warehouse , LocationLevel_SystemSetting FROM Location,SystemSetting WHERE No_Location = @No_Location">
  478. <Params>
  479. <Param name="@No_Location" type="Location.No_Location" sourceColumn="No_Location" />
  480. </Params>
  481. <Tables>
  482. <Table name="LocationLevelByName" />
  483. </Tables>
  484. </SearchLevelByName>
  485. </Search>
  486. </Server>
  487. <Lables>
  488. <Search>
  489. Empty();
  490. NewInstance();
  491. tbNo.ReadOnly=false;
  492. txtName.ReadOnly=true;
  493. txtComment.ReadOnly=true;
  494. cbSubjection.Enabled=false;
  495. toolBar.EnableSubmit=false;
  496. toolBar.EnableModify=false;
  497. toolBar.EnableDelete=false;
  498. toolBar.EnablePrint=false;
  499. #Location.CreateDate_Location=DBNull();
  500. #Location.LastModDate_Location=DBNull();
  501. #Location.LastModUser_Location=DBNull();
  502. <!--Search("SearchTree");-->
  503. UpdateForm(true, "");
  504. tbNo.Focus();
  505. @Status=0;
  506. </Search>
  507. <New>
  508. tbNo.ReadOnly=true;
  509. txtName.ReadOnly=false;
  510. txtComment.ReadOnly=false;
  511. cbSubjection.Enabled=true;
  512. toolBar.EnableSubmit=GetRight(@Title,"新增");
  513. toolBar.EnableModify=false;
  514. toolBar.EnableDelete=false;
  515. toolBar.EnablePrint=false;
  516. #Location.SubjectionID_Location=DBNull();
  517. #Location.ID_Location=NewGuid();
  518. #Location.No_Location=tbNo.CValue;
  519. #Location.CreateName=GetCurrentUser();
  520. #Location.ID_Creator=GetLoginUserID();
  521. #Location.CreateDate_Location=DateTimeNow();
  522. #Location.LastModDate_Location=DBNull();
  523. #Location.LastModUser_Location=DBNull();
  524. #Location.SuspendDate_Location=DBNull();
  525. <!--Search("SearchTree");-->
  526. UpdateForm(true, "");
  527. <!--LocationTree.SetCurrentNode("("+tbNo.CValue+")"+txtName.CValue);-->
  528. txtName.Focus();
  529. @Status=1;
  530. </New>
  531. <View>
  532. tbNo.ReadOnly=false;
  533. txtName.ReadOnly=true;
  534. txtComment.ReadOnly=true;
  535. cbSubjection.Enabled=false;
  536. toolBar.EnableSubmit=false;
  537. toolBar.EnablePrint=GetRight(@Title,"打印");
  538. toolBar.EnableModify=GetRight(@Title,"修改");
  539. toolBar.EnableDelete=GetRight(@Title,"删除");
  540. <!--Search("SearchTree");-->
  541. UpdateForm(true, "");
  542. <!--LocationTree.SetCurrentNode("("+tbNo.CValue+")"+txtName.CValue);-->
  543. @Status=2;
  544. </View>
  545. <Modify>
  546. tbNo.ReadOnly=true;
  547. txtName.ReadOnly=false;
  548. txtComment.ReadOnly=false;
  549. cbSubjection.Enabled=false;
  550. toolBar.EnableSubmit=GetRight(@Title,"新增");
  551. toolBar.EnableModify=false;
  552. toolBar.EnableDelete=GetRight(@Title,"删除");
  553. toolBar.EnablePrint=false;
  554. #Location.LastModDate_Location=DateTimeNow();
  555. #Location.LastModUser_Location=GetLoginUserID();
  556. #Location.LastModUser_LocationName=GetCurrentUser();
  557. <!--Search("SearchTree");-->
  558. UpdateForm(true, "");
  559. <!--LocationTree.SetCurrentNode("("+tbNo.CValue+")"+txtName.CValue);-->
  560. txtName.Focus();
  561. @Status=3;
  562. </Modify>
  563. <SubmitButtonClick>
  564. <![CDATA[
  565. if(txtName.CValue==StringEmpty())
  566. {
  567. MessageBox("请输入库位名称!",@Title);
  568. txtName.Focus();
  569. return;
  570. }
  571. if(!cbSubjection.CheckSelectedItem())
  572. {
  573. MessageBox("请选择有效的隶属库位!",@Title);
  574. cbSubjection.Focus();
  575. return;
  576. }
  577. UpdateForm(false, "");
  578. if(cbSubjection.SelectedNo != "")
  579. {
  580. Search("SearchLevelByName", cbSubjection.SelectedNo);
  581. if(#LocationLevelByName.Level_Location >= #LocationLevelByName.LocationLevel_SystemSetting)
  582. {
  583. if(MessageBox("库位级别超出系统启用设置中的级别确定要提交吗?",@Title,MB_YESNO) ==DialogResult("NO"))
  584. return;
  585. }
  586. }
  587. if(@Status==1)
  588. {
  589. New();
  590. }
  591. if(@Status == 3)
  592. {
  593. #Location.LastModDate_Location=DateTimeNow();
  594. Update();
  595. }
  596. ChangeMode("View");
  597. ]]>
  598. </SubmitButtonClick>
  599. </Lables>
  600. </Form>
  601. </Forms>