{"id":1367,"date":"2024-06-05T13:36:57","date_gmt":"2024-06-05T05:36:57","guid":{"rendered":"http:\/\/www.jh1999.cn\/?p=1367"},"modified":"2024-06-05T15:59:07","modified_gmt":"2024-06-05T07:59:07","slug":"%e6%9f%a5%e8%af%a2%e6%8a%a5%e8%a1%a8%e7%94%a8%e6%95%b0%e6%8d%ae%e5%80%bc%e5%81%9a%e6%a0%8f%e4%bd%8d%e3%80%90delphi%e3%80%91","status":"publish","type":"post","link":"http:\/\/www.jh1999.cn\/?p=1367","title":{"rendered":"\u67e5\u8be2\u62a5\u8868\u7528\u6570\u636e\u503c\u505a\u680f\u4f4d\u3010Delphi\u3011"},"content":{"rendered":"<div class=\"gb-container gb-container-6ab208ea\">\n\n<p class=\"has-medium-font-size wp-block-paragraph\">\u6211\u4eec\u7528Delphi\u505a\u6570\u636e\u5e93\u5e94\u7528\u5f00\u53d1\u65f6\uff0c\u5e38\u5e38\u4f1a\u8981\u6c42\u7528\u680f\u4f4d\u91cc\u7684\u67d0\u4e2a\u503c\u53d8\u6210\u680f\u4f4d\u6765\u7edf\u8ba1\u67e5\u8be2\uff0c\u6bd4\u5982\u67e5\u8be2\u67d0\u7269\u6599\u5728\u67d0\u4e00\u5e74\u5185\u5404\u4e2a\u6708\u4efd\u53d1\u751f\u7684\u6570\u91cf\u5c0f\u8ba1\uff1b\u518d\u5982\u67e5\u8be2\u67d0\u4e2a\u65f6\u671f\u5185\uff0c\u6bcf\u6b3e\u4ea7\u54c1\u7684\u9500\u552e\u6570\u91cf\uff1b\u518d\u5982\u67e5\u8be2\u67d0\u4e2a\u6708\u4efd\u5404\u4e2a\u90e8\u95e8\u7684\u5f00\u652f\u5408\u8ba1\uff0c\u7b49\u7b49\u3002<\/p>\n\n\n\n<p class=\"has-medium-font-size wp-block-paragraph\">\u4ee5\u4e0b\u662fDelphi + msSQL \u7684\u5b9e\u4f8b\u4ee3\u7801\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code has-medium-font-size\"><code>procedure TfmsoPackQty.nnEnqCompareClick(Sender: TObject);\nvar\n sSo:String;\n swhere,sLabel:String;\n i,j:Integer;\nbegin\n  inherited;\n  Screen.Cursor:=crSqlWait;\n  \/\/\u5efa\u4e34\u65f6\u8868\u548c\u521d\u59cb\u6570\u636e\n  sSo:=qMaster.fieldbyname('sono').AsString;\n  sSql:='if object_id(N''&#91;tempdb]..&#91;#_jhERPsoPack]'') is not null drop table &#91;#_jhERPsoPack] ';\n  sSql:=sSql+'Create table &#91;#_jhERPsoPack](&#91;itno]&#91;varchar](15),&#91;cono]&#91;varchar](7),'\n        +'&#91;Qty]&#91;int],&#91;pkQty]&#91;int]) ';\n  sSql:=sSql+'Insert into &#91;#_jhERPsoPack](itno,cono,Qty) Select itno,cono,qty '\n        +'from Salesub where sono='+''''+sSo+'''';\n  qry5.Close;\n  qry5.SQL.Text:=sSql;\n  qry5.ExecSQL;\n  \/\/\u586b\u7d2f\u8ba1\u5206\u5272\u6570\n  sSql:='update d1 set d1.pkQty=d2.Qtys from &#91;#_jhERPsoPack] d1,('\n        +'select itno,cono,sum(Qty)as Qtys from soPackLine where sono='+''''+sSo+''''\n        +' group by itno,cono)d2 where d1.itno=d2.itno and d1.cono=d2.cono ';\n  qry5.Close;\n  qry5.SQL.Text:=sSql;\n  qry5.ExecSQL;\n  \/\/\u88c5\u914d\u67e5\u8be2\u8bed\u53e5\n  qry5.Close;\n  qry5.SQL.Text:='select max(AreaID)as its from soPackLine where sono='+''''+sSo+'''';\n  qry5.Open;\n  j:=qry5.fieldbyname('its').AsInteger;\n  sSql:='Select d1.*,d1.Qty-d1.pkQty as QtyDiff';\n  for i:=0 to j do\n  begin\n    sLabel:='\u7b2c'+intToStr(i)+'\u6b21';\n    sWhere:=' where d2.itno=d1.itno and d2.cono=d1.cono and d2.AreaID='+intToStr(i);\n    sSql:=sSql+',(select d2.Qty from soPackLine d2'+sWhere+')as '+''''+sLabel+'''';\n  end;\n  sSql:=sSql+' from  &#91;#_jhERPsoPack] d1 ';\n  Dm1.Q1look.Close;\n  Dm1.Q1look.SQL.Text:=sSql;\n  Dm1.Q1look.Open;\n  if fmAlook=nil then fmAlook:=TfmAlook.create(application)else fmAlook.Show;\n  fmAlook.Lbl1.Caption:='\u8ba2\u5355\u8d70\u8d27\u5206\u5272\u6570\u91cf\u4e0e\u8ba2\u5355\u6570\u91cf\u5bf9\u6bd4';\n  fmAlook.NN3.Enabled:=true;\n with fmAlook.DBGridEh1 do\n begin\n  Columns&#91;0].Title.caption:='\u7269\u6599\u7f16\u53f7';\n  Columns&#91;1].Title.caption:='\u8272\u53f7';\n  Columns&#91;2].Title.caption:='\u8ba2\u5355\u6570\u91cf';\n  Columns&#91;3].Title.caption:='\u7d2f\u8ba1\u5206\u5272';\n  Columns&#91;4].Title.caption:='\u8ba2\u5355-\u5206\u5272';\n  Columns&#91;0].Footer.valuetype:=fvtStatictext;\n  Columns&#91;0].Footer.value:='\u5408\u8ba1';\n  for i:=2 to j+5 do\n  begin\n    Columns&#91;i].Footer.valuetype:=fvtSum;\n    Columns&#91;i].Footer.fieldName:=Columns&#91;i].FieldName;\n  end;\n end;\n dm1.GridReWidth(fmAlook.DBGridEh1);\n Screen.Cursor:=crDefault;\nend;<\/code><\/pre>\n\n<div class=\"gb-shapes\"><div class=\"gb-shape gb-shape-1\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 1200 194.3\" preserveAspectRatio=\"none\"><path d=\"M1200 133.3l-50 8.9c-50 8.6-150 26.9-250 31.1-100 4.2-200-4.2-300-26.7S400 89.2 300 62.2C200 35.8 100 17.5 50 8.9L0 0v194.3h1200v-61z\"\/><\/svg><\/div><\/div><\/div>","protected":false},"excerpt":{"rendered":"<p>\u6211\u4eec\u7528Delphi\u505a\u6570\u636e\u5e93\u5e94\u7528\u5f00\u53d1\u65f6\uff0c\u5e38\u5e38\u4f1a\u8981\u6c42\u7528\u680f\u4f4d\u91cc\u7684\u67d0\u4e2a\u503c\u53d8\u6210\u680f\u4f4d\u6765\u7edf\u8ba1\u67e5\u8be2\uff0c\u6bd4\u5982\u67e5\u8be2\u67d0\u7269\u6599\u5728\u67d0\u4e00\u5e74\u5185\u5404 &#8230; <a title=\"\u67e5\u8be2\u62a5\u8868\u7528\u6570\u636e\u503c\u505a\u680f\u4f4d\u3010Delphi\u3011\" class=\"read-more\" href=\"http:\/\/www.jh1999.cn\/?p=1367\" aria-label=\"Read more about \u67e5\u8be2\u62a5\u8868\u7528\u6570\u636e\u503c\u505a\u680f\u4f4d\u3010Delphi\u3011\">\u9605\u8bfb\u66f4\u591a<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-1367","post","type-post","status-publish","format-standard","hentry","category-kfbj"],"_links":{"self":[{"href":"http:\/\/www.jh1999.cn\/index.php?rest_route=\/wp\/v2\/posts\/1367","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.jh1999.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.jh1999.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.jh1999.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.jh1999.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1367"}],"version-history":[{"count":17,"href":"http:\/\/www.jh1999.cn\/index.php?rest_route=\/wp\/v2\/posts\/1367\/revisions"}],"predecessor-version":[{"id":1393,"href":"http:\/\/www.jh1999.cn\/index.php?rest_route=\/wp\/v2\/posts\/1367\/revisions\/1393"}],"wp:attachment":[{"href":"http:\/\/www.jh1999.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1367"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.jh1999.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1367"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.jh1999.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1367"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}