2428 lines
121 KiB
ObjectPascal
2428 lines
121 KiB
ObjectPascal
![]() |
unit U_PRTJYList;
|
|||
|
|
|||
|
interface
|
|||
|
|
|||
|
uses
|
|||
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
|||
|
Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
|
|||
|
cxDataStorage, cxEdit, DB, cxDBData, cxGridCustomTableView,
|
|||
|
cxGridTableView, cxGridBandedTableView, cxGridDBBandedTableView,
|
|||
|
cxGridLevel, cxClasses, cxControls, cxGridCustomView, cxGridDBTableView,
|
|||
|
cxGrid, StdCtrls, ComCtrls, ExtCtrls, ToolWin, cxGridCustomPopupMenu,
|
|||
|
cxGridPopupMenu, ADODB, DBClient, cxDropDownEdit, cxCheckBox, RM_Common,
|
|||
|
RM_Class, RM_e_Xls, RM_Dataset, RM_System, RM_GridReport, Menus, BtnEdit,
|
|||
|
cxTextEdit;
|
|||
|
|
|||
|
type
|
|||
|
TfrmPRTJYList = class(TForm)
|
|||
|
ToolBar1: TToolBar;
|
|||
|
TBRafresh: TToolButton;
|
|||
|
TBFind: TToolButton;
|
|||
|
TBExport: TToolButton;
|
|||
|
TBPrint: TToolButton;
|
|||
|
TBClose: TToolButton;
|
|||
|
Panel1: TPanel;
|
|||
|
ADOQueryCmd: TADOQuery;
|
|||
|
ADOQueryMain: TADOQuery;
|
|||
|
ADOQueryTemp: TADOQuery;
|
|||
|
DataSource1: TDataSource;
|
|||
|
cxGridPopupMenu1: TcxGridPopupMenu;
|
|||
|
Label3: TLabel;
|
|||
|
Label4: TLabel;
|
|||
|
MPRTCodeName: TEdit;
|
|||
|
PRTColor: TEdit;
|
|||
|
Label1: TLabel;
|
|||
|
Label2: TLabel;
|
|||
|
BegDate: TDateTimePicker;
|
|||
|
EndDate: TDateTimePicker;
|
|||
|
CDS_Main: TClientDataSet;
|
|||
|
Label5: TLabel;
|
|||
|
orderNo: TEdit;
|
|||
|
Label6: TLabel;
|
|||
|
MJID: TEdit;
|
|||
|
Label8: TLabel;
|
|||
|
MPRTKZ: TEdit;
|
|||
|
Label9: TLabel;
|
|||
|
MPRTMF: TEdit;
|
|||
|
Label7: TLabel;
|
|||
|
MJType: TComboBox;
|
|||
|
cxGrid2: TcxGrid;
|
|||
|
Tv1: TcxGridDBTableView;
|
|||
|
v1Column1: TcxGridDBColumn;
|
|||
|
v2Column1: TcxGridDBColumn;
|
|||
|
v2Column3: TcxGridDBColumn;
|
|||
|
v1Column8: TcxGridDBColumn;
|
|||
|
v1Column9: TcxGridDBColumn;
|
|||
|
v1Column6: TcxGridDBColumn;
|
|||
|
v1Column5: TcxGridDBColumn;
|
|||
|
v1Column3: TcxGridDBColumn;
|
|||
|
v1Column2: TcxGridDBColumn;
|
|||
|
v2Column6: TcxGridDBColumn;
|
|||
|
v1Column10: TcxGridDBColumn;
|
|||
|
cxGrid2Level1: TcxGridLevel;
|
|||
|
Label10: TLabel;
|
|||
|
SelfGangNo: TEdit;
|
|||
|
RM1: TRMGridReport;
|
|||
|
RMDBMain: TRMDBDataSet;
|
|||
|
RMXLSExport1: TRMXLSExport;
|
|||
|
RMDBHZ: TRMDBDataSet;
|
|||
|
CDS_HZ: TClientDataSet;
|
|||
|
CDS_PRT: TClientDataSet;
|
|||
|
v1Column4: TcxGridDBColumn;
|
|||
|
PopupMenu1: TPopupMenu;
|
|||
|
N1: TMenuItem;
|
|||
|
N2: TMenuItem;
|
|||
|
ToolButton1: TToolButton;
|
|||
|
v1Column11: TcxGridDBColumn;
|
|||
|
v1Column12: TcxGridDBColumn;
|
|||
|
v1Column13: TcxGridDBColumn;
|
|||
|
v1Column16: TcxGridDBColumn;
|
|||
|
v1Column17: TcxGridDBColumn;
|
|||
|
v1Column18: TcxGridDBColumn;
|
|||
|
v1Column19: TcxGridDBColumn;
|
|||
|
CDS_Juan: TClientDataSet;
|
|||
|
CDS_JuanPRT: TClientDataSet;
|
|||
|
RMDBMX: TRMDBDataSet;
|
|||
|
RM3: TRMGridReport;
|
|||
|
BtnEditA1: TBtnEditA;
|
|||
|
ADOQueryPrint: TADOQuery;
|
|||
|
Label11: TLabel;
|
|||
|
PRTHX: TEdit;
|
|||
|
v1Column7: TcxGridDBColumn;
|
|||
|
Panel4: TPanel;
|
|||
|
Label12: TLabel;
|
|||
|
Panel10: TPanel;
|
|||
|
Image2: TImage;
|
|||
|
RichEdit1: TRichEdit;
|
|||
|
v1Column14: TcxGridDBColumn;
|
|||
|
v1Column15: TcxGridDBColumn;
|
|||
|
v1Column20: TcxGridDBColumn;
|
|||
|
v1Column21: TcxGridDBColumn;
|
|||
|
Label36: TLabel;
|
|||
|
Label37: TLabel;
|
|||
|
LabNote1: TEdit;
|
|||
|
LabNote2: TEdit;
|
|||
|
v1Column22: TcxGridDBColumn;
|
|||
|
Panel2: TPanel;
|
|||
|
Panel3: TPanel;
|
|||
|
CheckBox1: TCheckBox;
|
|||
|
v1Column23: TcxGridDBColumn;
|
|||
|
v1Column24: TcxGridDBColumn;
|
|||
|
ToolButton3: TToolButton;
|
|||
|
v1Column25: TcxGridDBColumn;
|
|||
|
v1Column26: TcxGridDBColumn;
|
|||
|
v1Column27: TcxGridDBColumn;
|
|||
|
ToolButton4: TToolButton;
|
|||
|
RMDBCD: TRMDBDataSet;
|
|||
|
RMCD: TRMGridReport;
|
|||
|
CDS_LS: TClientDataSet;
|
|||
|
CDS_CD: TClientDataSet;
|
|||
|
Lot: TComboBox;
|
|||
|
procedure FormDestroy(Sender: TObject);
|
|||
|
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
|||
|
procedure FormCreate(Sender: TObject);
|
|||
|
procedure TBRafreshClick(Sender: TObject);
|
|||
|
procedure ConNoMChange(Sender: TObject);
|
|||
|
procedure TBCloseClick(Sender: TObject);
|
|||
|
procedure FormShow(Sender: TObject);
|
|||
|
procedure TBExportClick(Sender: TObject);
|
|||
|
procedure TBFindClick(Sender: TObject);
|
|||
|
procedure MPRTCodeNameChange(Sender: TObject);
|
|||
|
procedure TBPrintClick(Sender: TObject);
|
|||
|
procedure orderNoChange(Sender: TObject);
|
|||
|
procedure orderNoKeyPress(Sender: TObject; var Key: Char);
|
|||
|
procedure N1Click(Sender: TObject);
|
|||
|
procedure N2Click(Sender: TObject);
|
|||
|
procedure ToolButton1Click(Sender: TObject);
|
|||
|
procedure BtnEditA1BtnClick(Sender: TObject);
|
|||
|
procedure Panel10MouseMove(Sender: TObject; Shift: TShiftState; X,
|
|||
|
Y: Integer);
|
|||
|
procedure Tv1CellDblClick(Sender: TcxCustomGridTableView;
|
|||
|
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
|||
|
AShift: TShiftState; var AHandled: Boolean);
|
|||
|
procedure Image2Click(Sender: TObject);
|
|||
|
procedure Tv1MouseUp(Sender: TObject; Button: TMouseButton;
|
|||
|
Shift: TShiftState; X, Y: Integer);
|
|||
|
procedure v1Column24PropertiesEditValueChanged(Sender: TObject);
|
|||
|
procedure ToolButton3Click(Sender: TObject);
|
|||
|
procedure ToolButton4Click(Sender: TObject);
|
|||
|
private
|
|||
|
FLeft,FTop:Integer;
|
|||
|
procedure InitGrid();
|
|||
|
procedure GetLotData();
|
|||
|
procedure GetLotDataLie();
|
|||
|
procedure GetLotDataLie38();
|
|||
|
procedure GetLotDataLie38Ye();
|
|||
|
procedure GetBGData();
|
|||
|
procedure GetCDSData();
|
|||
|
{ Private declarations }
|
|||
|
public
|
|||
|
{ Public declarations }
|
|||
|
end;
|
|||
|
|
|||
|
var
|
|||
|
frmPRTJYList: TfrmPRTJYList;
|
|||
|
|
|||
|
implementation
|
|||
|
uses
|
|||
|
U_DataLink,U_RTFun,U_ZDYHelp,U_MJEdit;
|
|||
|
|
|||
|
{$R *.dfm}
|
|||
|
|
|||
|
procedure TfrmPRTJYList.FormDestroy(Sender: TObject);
|
|||
|
begin
|
|||
|
frmPRTJYList:=nil;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPRTJYList.FormClose(Sender: TObject;
|
|||
|
var Action: TCloseAction);
|
|||
|
begin
|
|||
|
Action:=caFree;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPRTJYList.FormCreate(Sender: TObject);
|
|||
|
begin
|
|||
|
//cxGrid1.Align:=alClient;
|
|||
|
BegDate.DateTime:=SGetServerDateTime(ADOQueryTemp);
|
|||
|
EndDate.DateTime:=SGetServerDateTime(ADOQueryTemp)
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPRTJYList.InitGrid();
|
|||
|
begin
|
|||
|
try
|
|||
|
ADOQueryMain.DisableControls;
|
|||
|
with ADOQueryMain do
|
|||
|
begin
|
|||
|
Filtered:=False;
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
SQL.Add('select D.*,C.PiTiaoQty,C.OrderUnit,');
|
|||
|
sql.Add(' Case when D.MJLen>0 then D.KouFenHZ*1.00*100/(MJLen*MJFK) else Null end as KouFenAvg,');
|
|||
|
SQL.Add(' B.OrderNo,MPRTCode=isnull(B.MPRTCode,'''')+isnull(B.MPRTGY,''''),B.MPRTCodeName,B.MPRTMF,B.MPRTKZ,B.OrderNo,B.CustomerNoName,');
|
|||
|
SQL.Add(' PRTColor=Rtrim(isnull(C.PRTColorNo,''''))+'' ''+Rtrim(isnull(C.PRTColor,''''))+'' ''+RTrim(isnull(C.PRTColorEng,'''')) ,C.PRTHX,');
|
|||
|
sql.Add(' GangNo=E.SelfGangNo ,B.CustomerNoName,'); //YQty=Cast(D.MJLen*1.0936 as decimal(18,1)),
|
|||
|
sql.Add(' Case when isnull(D.MJLenMa,-1)<=0 then Cast(D.MJLen*1.0936 as decimal(18,1)) else Cast(D.MJLenMa*1 as decimal(18,1)) end as YQty, ');
|
|||
|
SQL.Add(' CDQK=dbo.F_Get_Order_SubStr(D.MJID,''MJCDHZSL'')');
|
|||
|
sql.Add(',JYDate=CONVERT(varchar(10) , D.FillTime,120 ) ');
|
|||
|
sql.add('from WFB_MJJY D ');
|
|||
|
Sql.add(' inner join JYOrder_Main B on D.MainId=B.MainId');
|
|||
|
Sql.add(' inner join JYOrder_Sub C on D.SubId=C.SubId');
|
|||
|
sql.Add(' inner join JYOrder_Main_MD E on D.APID=E.MDID');
|
|||
|
sql.add('where D.FillTime>='''+Trim(FormatDateTime('yyyy-MM-dd',BegDate.DateTime))+''' and D.FillTime<'''+Trim(FormatDateTime('yyyy-MM-dd',enddate.DateTime+1))+'''');
|
|||
|
Open;
|
|||
|
//ShowMessage(SQL.Text);
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryMain,CDS_Main);
|
|||
|
SInitCDSData20(ADOQueryMain,CDS_Main);
|
|||
|
finally
|
|||
|
ADOQueryMain.EnableControls;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPRTJYList.TBRafreshClick(Sender: TObject);
|
|||
|
begin
|
|||
|
BegDate.SetFocus;
|
|||
|
InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPRTJYList.ConNoMChange(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.Active then
|
|||
|
begin
|
|||
|
SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPRTJYList.TBCloseClick(Sender: TObject);
|
|||
|
begin
|
|||
|
WriteCxGrid('<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>CX',Tv1,'<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>');
|
|||
|
Close;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPRTJYList.FormShow(Sender: TObject);
|
|||
|
begin
|
|||
|
|
|||
|
ReadCxGrid('<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>CX',Tv1,'<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>');
|
|||
|
{if Trim(DParameters2)='<27><><EFBFBD><EFBFBD>' then
|
|||
|
begin
|
|||
|
TBRKCX.Visible:=True;
|
|||
|
end else
|
|||
|
begin
|
|||
|
v1Column4.Visible:=False;
|
|||
|
end; }
|
|||
|
//InitGrid();
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPRTJYList.TBExportClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.IsEmpty then exit;
|
|||
|
|
|||
|
TcxGridToExcel('<27><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>',cxGrid2);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPRTJYList.TBFindClick(Sender: TObject);
|
|||
|
begin
|
|||
|
if ADOQueryMain.Active then
|
|||
|
begin
|
|||
|
SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
|
|||
|
SCreateCDS20(ADOQueryMain,CDS_Main);
|
|||
|
SInitCDSData20(ADOQueryMain,CDS_Main);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPRTJYList.MPRTCodeNameChange(Sender: TObject);
|
|||
|
begin
|
|||
|
TBFind.Click;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPRTJYList.TBPrintClick(Sender: TObject);
|
|||
|
var
|
|||
|
fPrintFile:String;
|
|||
|
begin
|
|||
|
if CDS_Main.Locate('SSel',True,[])=False then
|
|||
|
begin
|
|||
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>','<27><>ʾ',0);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
with CDS_Main do
|
|||
|
begin
|
|||
|
while Locate('SSel',True,[])=True do
|
|||
|
begin
|
|||
|
with ADOQueryPrint do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add('exec P_Print_Lable :MJID');
|
|||
|
Parameters.ParamByName('MJID').Value:=Trim(CDS_Main.fieldbyname('MJID').AsString);
|
|||
|
Open;
|
|||
|
end;
|
|||
|
if Trim(ADOQueryPrint.fieldbyname('SLBName').AsString)<>'' then
|
|||
|
fPrintFile:=ExtractFilePath(Application.ExeName)+'Report\'+Trim(ADOQueryPrint.fieldbyname('SLBName').AsString)
|
|||
|
else
|
|||
|
fPrintFile:=ExtractFilePath(Application.ExeName)+'Report\ͨ<><CDA8>Ӣ<EFBFBD>ı<EFBFBD>ǩ.rmf' ;
|
|||
|
if FileExists(fPrintFile) then
|
|||
|
begin
|
|||
|
RMVariables['LabNote1']:=Trim(LabNote1.Text);
|
|||
|
RMVariables['LabNote2']:=Trim(LabNote2.Text);
|
|||
|
RM1.LoadFromFile(fPrintFile);
|
|||
|
//RM1.ShowReport;
|
|||
|
RM1.PrintReport;
|
|||
|
end else
|
|||
|
begin
|
|||
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>'+ExtractFilePath(Application.ExeName)+'Report\'+Trim(ADOQueryPrint.fieldbyname('SLBName').AsString)),'<27><>ʾ',0);
|
|||
|
end;
|
|||
|
CDS_Main.Edit;
|
|||
|
CDS_Main.FieldByName('SSel').Value:=False;
|
|||
|
CDS_Main.Post;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPRTJYList.orderNoChange(Sender: TObject);
|
|||
|
begin
|
|||
|
if Length(Trim(orderNo.Text))<4 then Exit;
|
|||
|
TBFind.Click;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPRTJYList.orderNoKeyPress(Sender: TObject;
|
|||
|
var Key: Char);
|
|||
|
begin
|
|||
|
if Key=#13 then
|
|||
|
begin
|
|||
|
if Length(Trim(orderNo.Text))<4 then Exit;
|
|||
|
try
|
|||
|
ADOQueryMain.DisableControls;
|
|||
|
with ADOQueryMain do
|
|||
|
begin
|
|||
|
Filtered:=False;
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
SQL.Add('select D.*,C.PiTiaoQty,C.OrderUnit,');
|
|||
|
sql.Add(' Case when D.MJLen>0 then D.KouFenHZ*1.00*100/(MJLen*MJFK) else Null end as KouFenAvg,');
|
|||
|
SQL.Add(' B.OrderNo,MPRTCode=isnull(B.MPRTCode,'''')+isnull(B.MPRTGY,''''),B.MPRTCodeName,B.MPRTMF,B.MPRTKZ,B.OrderNo,B.CustomerNoName,');
|
|||
|
//SQL.Add(' C.PRTColor,C.PRTHX,C.PRTColorEng,C.PRTColorNo,');
|
|||
|
SQL.Add(' PRTColor=Rtrim(isnull(C.PRTColorNo,''''))+'' ''+Rtrim(isnull(C.PRTColor,''''))+'' ''+RTrim(isnull(C.PRTColorEng,'''')) ,C.PRTHX,');
|
|||
|
sql.Add(' E.SelfGangNo,E.GangNo,B.CustomerNoName,'); //YQty=Cast(D.MJLen*1.0936 as decimal(18,1))
|
|||
|
sql.Add(' Case when isnull(D.MJLenMa,-1)<=0 then Cast(D.MJLen*1.0936 as decimal(18,1)) else Cast(D.MJLenMa*1 as decimal(18,1)) end as YQty, ');
|
|||
|
SQL.Add(' CDQK=dbo.F_Get_Order_SubStr(D.MJID,''MJCDHZSL''),');
|
|||
|
sql.Add(' JYDate=CONVERT(varchar(10) , D.FillTime,120 ) ');
|
|||
|
sql.add('from WFB_MJJY D ');
|
|||
|
Sql.add(' inner join JYOrder_Main B on D.MainId=B.MainId');
|
|||
|
Sql.add(' inner join JYOrder_Sub C on D.SubId=C.SubId');
|
|||
|
sql.Add(' inner join JYOrder_Main_MD E on D.APID=E.MDID');
|
|||
|
sql.add('where B.OrderNo like '''+'%'+Trim(orderNo.Text)+'%'+'''');
|
|||
|
|
|||
|
|
|||
|
Open;
|
|||
|
//ShowMessage(SQL.Text);
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryMain,CDS_Main);
|
|||
|
SInitCDSData20(ADOQueryMain,CDS_Main);
|
|||
|
finally
|
|||
|
ADOQueryMain.EnableControls;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPRTJYList.N1Click(Sender: TObject);
|
|||
|
begin
|
|||
|
SelOKNo(CDS_Main,True);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPRTJYList.N2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
SelOKNo(CDS_Main,False);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPRTJYList.GetLotData();
|
|||
|
var
|
|||
|
i,j,z,h,q,Hang,GHang:Integer;
|
|||
|
FGangNo,FHZ,FSubId:String;
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then Exit;
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select GangNo=MD.SelfGangNo,A.MJXH,A.MJMaoZ,A.SubId,A.MainId,A.MJQty4,');
|
|||
|
sql.Add(' Case when isnull(A.DuoPinNote,'''')<>'''' then ''(''+RTrim(A.DuoPinNote)+'')'' else A.DuoPinNote end as DPNote,');
|
|||
|
if Pos('Y',Trim(BtnEditA1.Text))>0 then
|
|||
|
begin
|
|||
|
sql.Add(' Case when isnull(A.MJLenMa,-1)=-1 then Cast(A.MJLen*1.0936 as decimal(18,1)) else Cast(A.MJLenMa*1 as decimal(18,1)) end as MJLen, ');
|
|||
|
end else
|
|||
|
begin
|
|||
|
sql.Add('A.MJLen,');
|
|||
|
end;
|
|||
|
sql.Add('DD.OrderNo,JS.PRTColor,PRTEColor=JS.PRTColorEng,PRTColorNo=JS.PRTColorNo,JS.PRTHX,');
|
|||
|
sql.Add(' JJQty=(select Count(MJID) from WFB_MJJY WM where WM.SubId=JS.SubId');
|
|||
|
if CheckBox1.Checked=false then
|
|||
|
begin
|
|||
|
sql.Add(' and WM.ZhuangXiangSYFlag=0 ');
|
|||
|
end else
|
|||
|
begin
|
|||
|
sql.Add(' and WM.ZhuangXiangSYFlag=1 ');
|
|||
|
end;
|
|||
|
if Trim(MJType.Text)<>'' then
|
|||
|
begin
|
|||
|
sql.Add(' and WM.MJType='''+Trim(MJType.Text)+'''');
|
|||
|
end;
|
|||
|
sql.Add('),');
|
|||
|
sql.Add(' GKgQty=(select sum(MJQty4) from WFB_MJJY WM inner join JYOrder_Main_MD JMD on WM.APID=JMD.MDID ');
|
|||
|
sql.add(' where WM.SubId=JS.SubId and JMD.SelfGangNo=MD.SelfGangNo') ;
|
|||
|
if CheckBox1.Checked=false then
|
|||
|
begin
|
|||
|
sql.Add(' and WM.ZhuangXiangSYFlag=0 ');
|
|||
|
end else
|
|||
|
begin
|
|||
|
sql.Add(' and WM.ZhuangXiangSYFlag=1 ');
|
|||
|
end;
|
|||
|
if Trim(MJType.Text)<>'' then
|
|||
|
begin
|
|||
|
sql.Add(' and WM.MJType='''+Trim(MJType.Text)+'''');
|
|||
|
end;
|
|||
|
sql.Add('),');
|
|||
|
sql.Add(' GGQty=(select Count(MJID) from WFB_MJJY WM inner join JYOrder_Main_MD JMD on WM.APID=JMD.MDID ');
|
|||
|
sql.add(' where WM.SubId=JS.SubId and JMD.SelfGangNo=MD.SelfGangNo') ;
|
|||
|
if CheckBox1.Checked=false then
|
|||
|
begin
|
|||
|
sql.Add(' and WM.ZhuangXiangSYFlag=0');
|
|||
|
end else
|
|||
|
begin
|
|||
|
sql.Add(' and WM.ZhuangXiangSYFlag=1');
|
|||
|
end;
|
|||
|
if Trim(MJType.Text)<>'' then
|
|||
|
begin
|
|||
|
sql.Add(' and WM.MJType='''+Trim(MJType.Text)+'''');
|
|||
|
end;
|
|||
|
sql.Add(')');
|
|||
|
sql.Add(' from WFB_MJJY A');
|
|||
|
sql.Add(' inner join JYOrder_Main DD on A.MainId=DD.MainId');
|
|||
|
sql.Add(' inner join JYOrder_Sub JS on A.SubId=JS.SubId');
|
|||
|
sql.Add(' inner join JYOrder_Main_MD MD on A.APID=MD.MDID');
|
|||
|
sql.Add(' where A.MainId='''+Trim(CDS_Main.fieldbyname('MainId').AsString)+'''');
|
|||
|
//sql.Add(' and A.ZhuangXiangSYFlag=0');
|
|||
|
if CheckBox1.Checked=False then
|
|||
|
sql.Add(' and A.ZhuangXiangSYFlag=0')
|
|||
|
else
|
|||
|
sql.Add(' and A.ZhuangXiangSYFlag=1');
|
|||
|
if Trim(MJType.Text)<>'' then
|
|||
|
begin
|
|||
|
sql.Add(' and A.MJType='''+Trim(MJType.Text)+'''');
|
|||
|
end;
|
|||
|
//sql.Add(' order by A.SubId,Cast(MD.SelfGangNo as int),A.MJXH');
|
|||
|
sql.Add(' order by JS.XHInt,JS.PRTHX,JS.PRTColorNo, Cast(MD.SelfGangNo as int),A.MJXH ');
|
|||
|
// ShowMessage(sql.Text);
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryTemp,CDS_Juan);
|
|||
|
SInitCDSData20(ADOQueryTemp,CDS_Juan);
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select MainId=Cast('''' as varchar(20)),SubId=Cast('''' as varchar(20)),');
|
|||
|
sql.Add(' PRTEColor=Cast('''' as varchar(20)),PRTHX=Cast('''' as varchar(20)),PRTColorNo=Cast('''' as varchar(20)),');
|
|||
|
sql.Add(' GangNo=Cast('''' as varchar(20)),BaoNo=Cast('''' as varchar(20)),XH=Cast(0 as int),');
|
|||
|
sql.Add(' LenQty0=Cast(1.00 as decimal(18,1)),LenQty1=Cast(1.00 as decimal(18,1)),');
|
|||
|
sql.Add(' LenQty2=Cast(1.00 as decimal(18,1)),LenQty3=Cast(1.00 as decimal(18,1)),');
|
|||
|
sql.Add(' LenQty4=Cast(1.00 as decimal(18,1)),LenQty5=Cast(1.00 as decimal(18,1)),');
|
|||
|
sql.Add(' LenQty6=Cast(1.00 as decimal(18,1)),LenQty7=Cast(1.00 as decimal(18,1)),');
|
|||
|
sql.Add(' LenQty8=Cast(1.00 as decimal(18,1)),LenQty9=Cast(1.00 as decimal(18,1)),');
|
|||
|
sql.Add(' MZ0=Cast(1.00 as decimal(18,2)),MZ1=Cast(1.00 as decimal(18,2)),');
|
|||
|
sql.Add(' MZ2=Cast(1.00 as decimal(18,2)),MZ3=Cast(1.00 as decimal(18,2)),');
|
|||
|
sql.Add(' MZ4=Cast(1.00 as decimal(18,2)),MZ5=Cast(1.00 as decimal(18,2)),');
|
|||
|
sql.Add(' MZ6=Cast(1.00 as decimal(18,2)),MZ7=Cast(1.00 as decimal(18,2)),');
|
|||
|
sql.Add(' MZ8=Cast(1.00 as decimal(18,2)),MZ9=Cast(1.00 as decimal(18,2)),');
|
|||
|
sql.Add(' JZ0=Cast(1.00 as decimal(18,2)),JZ1=Cast(1.00 as decimal(18,2)),');
|
|||
|
sql.Add(' JZ2=Cast(1.00 as decimal(18,2)),JZ3=Cast(1.00 as decimal(18,2)),');
|
|||
|
sql.Add(' JZ4=Cast(1.00 as decimal(18,2)),JZ5=Cast(1.00 as decimal(18,2)),');
|
|||
|
sql.Add(' JZ6=Cast(1.00 as decimal(18,2)),JZ7=Cast(1.00 as decimal(18,2)),');
|
|||
|
sql.Add(' JZ8=Cast(1.00 as decimal(18,2)),JZ9=Cast(1.00 as decimal(18,2)),');
|
|||
|
sql.Add(' DP0=Cast('''' as varchar(20)),DP1=Cast('''' as varchar(20)),');
|
|||
|
sql.Add(' DP2=Cast('''' as varchar(20)),DP3=Cast('''' as varchar(20)),');
|
|||
|
sql.Add(' DP4=Cast('''' as varchar(20)),DP5=Cast('''' as varchar(20)),');
|
|||
|
sql.Add(' DP6=Cast('''' as varchar(20)),DP7=Cast('''' as varchar(20)),');
|
|||
|
sql.Add(' DP8=Cast('''' as varchar(20)),DP9=Cast('''' as varchar(20)),');
|
|||
|
sql.Add(' MJPS0=Cast(1 as int),MJPS1=Cast(1 as int),');
|
|||
|
sql.Add(' MJPS2=Cast(1 as int),MJPS3=Cast(1 as int),');
|
|||
|
sql.Add(' MJPS4=Cast(1 as int),MJPS5=Cast(1 as int),');
|
|||
|
sql.Add(' MJPS6=Cast(1 as int),MJPS7=Cast(1 as int),');
|
|||
|
sql.Add(' MJPS8=Cast(1 as int),MJPS9=Cast(1 as int),');
|
|||
|
sql.Add(' JuanQty=Cast(0 as int),GangQty=Cast(0 as int),GangKgQty=Cast(0 as decimal(18,2)),');
|
|||
|
sql.Add(' XH=Cast(0 as int),Hang=Cast(0 as int),GHang=Cast(0 as int)');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryTemp,CDS_JuanPRT);
|
|||
|
SInitCDSData20(ADOQueryTemp,CDS_JuanPRT);
|
|||
|
if CDS_JuanPRT.IsEmpty=False then
|
|||
|
begin
|
|||
|
CDS_JuanPRT.Delete;
|
|||
|
end;
|
|||
|
i:=0;j:=0;z:=0;FGangNo:='';h:=0;hang:=0; GHang:=0;
|
|||
|
CDS_Juan.DisableControls;
|
|||
|
with CDS_Juan do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
//FHZ:=Trim(CDS_Juan.fieldbyname('SubId').AsString)+Trim(CDS_Juan.fieldbyname('BaoNO').AsString)
|
|||
|
//+Trim(CDS_Juan.fieldbyname('GangNo').AsString);
|
|||
|
with CDS_JuanPRT do
|
|||
|
begin
|
|||
|
if CDS_JuanPRT.IsEmpty then
|
|||
|
begin
|
|||
|
CDS_JuanPRT.Append;
|
|||
|
CDS_JuanPRT.FieldByName('GangNo').Value:=CDS_Juan.fieldbyname('GangNo').Value;
|
|||
|
// CDS_JuanPRT.FieldByName('BaoNO').Value:=CDS_Juan.fieldbyname('BaoNO').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTEColor').Value:=CDS_Juan.fieldbyname('PRTEColor').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTColorNo').Value:=CDS_Juan.fieldbyname('PRTColorNo').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTHX').Value:=CDS_Juan.fieldbyname('PRTHX').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MJPS0').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('XH').Value:=0;
|
|||
|
CDS_JuanPRT.FieldByName('Hang').Value:=0;
|
|||
|
CDS_JuanPRT.FieldByName('GHang').Value:=0;
|
|||
|
CDS_JuanPRT.FieldByName('LenQty0').Value:=CDS_Juan.fieldbyname('MJLen').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MZ0').Value:=CDS_Juan.fieldbyname('MJMaoZ').Value;
|
|||
|
CDS_JuanPRT.FieldByName('JZ0').Value:=CDS_Juan.fieldbyname('MJQty4').Value;
|
|||
|
CDS_JuanPRT.FieldByName('DP0').Value:=CDS_Juan.fieldbyname('DPNote').Value;
|
|||
|
CDS_JuanPRT.FieldByName('SubId').Value:=CDS_Juan.fieldbyname('SubId').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MainId').Value:=CDS_Juan.fieldbyname('MainId').Value;
|
|||
|
CDS_JuanPRT.FieldByName('JuanQty').Value:=CDS_Juan.fieldbyname('JJQty').Value;
|
|||
|
CDS_JuanPRT.FieldByName('GangQty').Value:=CDS_Juan.fieldbyname('GGQty').Value;
|
|||
|
CDS_JuanPRT.FieldByName('GangKgQty').Value:=CDS_Juan.fieldbyname('GKgQty').Value;
|
|||
|
CDS_JuanPRT.Post;
|
|||
|
FHZ:=Trim(CDS_Juan.fieldbyname('SubId').AsString)
|
|||
|
+Trim(CDS_Juan.fieldbyname('GangNo').AsString);
|
|||
|
FSubId:=Trim(CDS_Juan.fieldbyname('SubId').AsString);
|
|||
|
//FGangNo:=Trim(CDS_Juan.fieldbyname('GangNo').AsString);
|
|||
|
Z:=0;//gang <20><>
|
|||
|
j:=0;//<2F>к<EFBFBD>
|
|||
|
for i:=1 to 9 do
|
|||
|
begin
|
|||
|
CDS_JuanPRT.Edit;
|
|||
|
CDS_JuanPRT.FieldByName('MJPS'+Trim(IntToStr(i))).Value:=0;
|
|||
|
CDS_JuanPRT.Post;
|
|||
|
end;
|
|||
|
end else
|
|||
|
begin
|
|||
|
if (Trim(CDS_Juan.fieldbyname('SubId').AsString)
|
|||
|
+Trim(CDS_Juan.fieldbyname('GangNo').AsString))<>FHZ then
|
|||
|
begin
|
|||
|
GHang:=0;
|
|||
|
if Trim(CDS_Juan.fieldbyname('SubId').AsString)<>FSubId then
|
|||
|
begin
|
|||
|
Hang:=0;
|
|||
|
end else
|
|||
|
begin
|
|||
|
Hang:=Hang+1;
|
|||
|
end;
|
|||
|
CDS_JuanPRT.Append;
|
|||
|
CDS_JuanPRT.FieldByName('GangNo').Value:=CDS_Juan.fieldbyname('GangNo').Value;
|
|||
|
//CDS_JuanPRT.FieldByName('BaoNO').Value:=CDS_Juan.fieldbyname('BaoNO').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTEColor').Value:=CDS_Juan.fieldbyname('PRTEColor').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTColorNo').Value:=CDS_Juan.fieldbyname('PRTColorNo').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTHX').Value:=CDS_Juan.fieldbyname('PRTHX').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MJPS0').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('XH').Value:=J+1;
|
|||
|
CDS_JuanPRT.FieldByName('Hang').Value:=Hang;
|
|||
|
CDS_JuanPRT.FieldByName('GHang').Value:=GHang;
|
|||
|
CDS_JuanPRT.FieldByName('LenQty0').Value:=CDS_Juan.fieldbyname('MJLen').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MZ0').Value:=CDS_Juan.fieldbyname('MJMaoZ').Value;
|
|||
|
CDS_JuanPRT.FieldByName('JZ0').Value:=CDS_Juan.fieldbyname('MJQty4').Value;
|
|||
|
CDS_JuanPRT.FieldByName('DP0').Value:=CDS_Juan.fieldbyname('DPNote').Value;
|
|||
|
CDS_JuanPRT.FieldByName('SubId').Value:=CDS_Juan.fieldbyname('SubId').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MainId').Value:=CDS_Juan.fieldbyname('MainId').Value;
|
|||
|
CDS_JuanPRT.FieldByName('JuanQty').Value:=CDS_Juan.fieldbyname('JJQty').Value;
|
|||
|
CDS_JuanPRT.FieldByName('GangQty').Value:=CDS_Juan.fieldbyname('GGQty').Value;
|
|||
|
CDS_JuanPRT.FieldByName('GangKgQty').Value:=CDS_Juan.fieldbyname('GKgQty').Value;
|
|||
|
CDS_JuanPRT.Post;
|
|||
|
FHZ:=Trim(CDS_Juan.fieldbyname('SubId').AsString)
|
|||
|
+Trim(CDS_Juan.fieldbyname('GangNo').AsString);
|
|||
|
Z:=0;//gang <20><>
|
|||
|
j:=j+1;//<2F>к<EFBFBD>
|
|||
|
for i:=1 to 9 do
|
|||
|
begin
|
|||
|
CDS_JuanPRT.Edit;
|
|||
|
CDS_JuanPRT.FieldByName('MJPS'+Trim(IntToStr(i))).Value:=0;
|
|||
|
CDS_JuanPRT.Post;
|
|||
|
end;
|
|||
|
end else
|
|||
|
begin
|
|||
|
if Z<10 then
|
|||
|
begin
|
|||
|
CDS_JuanPRT.Locate('XH',j,[]);
|
|||
|
with CDS_JuanPRT do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName('GangNo').Value:=CDS_Juan.fieldbyname('GangNo').Value;
|
|||
|
//FieldByName('BaoNO').Value:=CDS_Juan.fieldbyname('BaoNO').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTEColor').Value:=CDS_Juan.fieldbyname('PRTEColor').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTColorNo').Value:=CDS_Juan.fieldbyname('PRTColorNo').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTHX').Value:=CDS_Juan.fieldbyname('PRTHX').Value;
|
|||
|
FieldByName('MJPS'+Trim(IntToStr(Z))).Value:=1;
|
|||
|
FieldByName('LenQty'+Trim(IntToStr(Z))).Value:=CDS_Juan.fieldbyname('MJLen').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MZ'+Trim(IntToStr(Z))).Value:=CDS_Juan.fieldbyname('MJMaoZ').Value;
|
|||
|
CDS_JuanPRT.FieldByName('JZ'+Trim(IntToStr(Z))).Value:=CDS_Juan.fieldbyname('MJQty4').Value;
|
|||
|
CDS_JuanPRT.FieldByName('DP'+Trim(IntToStr(Z))).Value:=CDS_Juan.fieldbyname('DPNote').Value;
|
|||
|
FieldByName('SubId').Value:=CDS_Juan.fieldbyname('SubId').Value;
|
|||
|
FieldByName('MainId').Value:=CDS_Juan.fieldbyname('MainId').Value;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
end else
|
|||
|
begin
|
|||
|
GHang:=GHang+1;
|
|||
|
Hang:=Hang+1;
|
|||
|
CDS_JuanPRT.Append;
|
|||
|
CDS_JuanPRT.FieldByName('GangNo').Value:=CDS_Juan.fieldbyname('GangNo').Value;
|
|||
|
//CDS_JuanPRT.FieldByName('BaoNO').Value:=CDS_Juan.fieldbyname('BaoNO').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTEColor').Value:=CDS_Juan.fieldbyname('PRTEColor').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTColorNo').Value:=CDS_Juan.fieldbyname('PRTColorNo').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTHX').Value:=CDS_Juan.fieldbyname('PRTHX').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MJPS0').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('XH').Value:=J+1;
|
|||
|
CDS_JuanPRT.FieldByName('Hang').Value:=Hang;
|
|||
|
CDS_JuanPRT.FieldByName('GHang').Value:=GHang;
|
|||
|
CDS_JuanPRT.FieldByName('LenQty0').Value:=CDS_Juan.fieldbyname('MJLen').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MZ0').Value:=CDS_Juan.fieldbyname('MJMaoZ').Value;
|
|||
|
CDS_JuanPRT.FieldByName('JZ0').Value:=CDS_Juan.fieldbyname('MJQty4').Value;
|
|||
|
CDS_JuanPRT.FieldByName('DP0').Value:=CDS_Juan.fieldbyname('DPNote').Value;
|
|||
|
CDS_JuanPRT.FieldByName('SubId').Value:=CDS_Juan.fieldbyname('SubId').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MainId').Value:=CDS_Juan.fieldbyname('MainId').Value;
|
|||
|
CDS_JuanPRT.FieldByName('JuanQty').Value:=CDS_Juan.fieldbyname('JJQty').Value;
|
|||
|
CDS_JuanPRT.FieldByName('GangQty').Value:=CDS_Juan.fieldbyname('GGQty').Value;
|
|||
|
CDS_JuanPRT.FieldByName('GangKgQty').Value:=CDS_Juan.fieldbyname('GKgQty').Value;
|
|||
|
CDS_JuanPRT.Post;
|
|||
|
Z:=0;//gang <20><>
|
|||
|
j:=j+1;//<2F>к<EFBFBD>
|
|||
|
for i:=1 to 9 do
|
|||
|
begin
|
|||
|
CDS_JuanPRT.Edit;
|
|||
|
CDS_JuanPRT.FieldByName('MJPS'+Trim(IntToStr(i))).Value:=0;
|
|||
|
CDS_JuanPRT.Post;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end
|
|||
|
end;
|
|||
|
Z:=Z+1;
|
|||
|
Next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
CDS_Juan.EnableControls;
|
|||
|
end;
|
|||
|
procedure TfrmPRTJYList.GetLotDataLie();
|
|||
|
var
|
|||
|
i,j,z,H,q,L,Y:Integer;
|
|||
|
FGangNo,FHZ,Lot0,Lot1,Lot2,Lot3,FSubId:String;
|
|||
|
begin
|
|||
|
|
|||
|
|
|||
|
if CDS_Main.IsEmpty then Exit;
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select GangNo=MD.SelfGangNo,A.MJXH,A.MJMaoZ,A.SubId,A.MainId,A.MJQty4,');
|
|||
|
if Pos('Y',Trim(BtnEditA1.Text))>0 then
|
|||
|
begin
|
|||
|
//sql.Add('MJLen=Cast(A.MJLen*1.0936 as decimal(18,1)),');
|
|||
|
sql.Add(' Case when isnull(A.MJLenMa,-1)=-1 then Cast(A.MJLen*1.0936 as decimal(18,1)) else Cast(A.MJLenMa*1 as decimal(18,1)) end as MJLen ');
|
|||
|
end else
|
|||
|
begin
|
|||
|
sql.Add('A.MJLen,');
|
|||
|
end;
|
|||
|
sql.Add('DD.OrderNo,JS.PRTColor,PRTEColor=JS.PRTColorEng,PRTColorNo=JS.PRTColorNo,JS.PRTHX,');
|
|||
|
sql.Add(' JQty=(select Count(*) from WFB_MJJY WM where WM.SubId=JS.SubId),');
|
|||
|
sql.Add(' GQty=(select Count(*) from WFB_MJJY WM inner join JYOrder_Main_MD JMD on WM.APID=JMD.MDID ');
|
|||
|
sql.add(' where WM.SubId=JS.SubId and JMD.SelfGangNo=MD.SelfGangNo)') ;
|
|||
|
sql.Add(' from WFB_MJJY A');
|
|||
|
sql.Add(' inner join JYOrder_Main DD on A.MainId=DD.MainId');
|
|||
|
sql.Add(' inner join JYOrder_Sub JS on A.SubId=JS.SubId');
|
|||
|
sql.Add(' inner join JYOrder_Main_MD MD on A.APID=MD.MDID');
|
|||
|
sql.Add(' where A.MainId='''+Trim(CDS_Main.fieldbyname('MainId').AsString)+'''');
|
|||
|
if CheckBox1.Checked=False then
|
|||
|
sql.Add(' and A.ZhuangXiangSYFlag=0')
|
|||
|
else
|
|||
|
sql.Add(' and A.ZhuangXiangSYFlag=1');
|
|||
|
//sql.Add(' and A.SubId=''JS1402100003'' ');
|
|||
|
//sql.Add(' and A.Valie=''Y'' ');
|
|||
|
if Trim(MJType.Text)<>'' then
|
|||
|
begin
|
|||
|
sql.Add(' and A.MJType='''+Trim(MJType.Text)+'''');
|
|||
|
end;
|
|||
|
//sql.Add(' order by JS.PRTHX,JS.PRTColorNo, Cast(MD.SelfGangNo as int),A.MJXH '); //JS.SubId,
|
|||
|
sql.Add(' order by JS.XHInt,JS.PRTHX,JS.PRTColorNo, Cast(MD.SelfGangNo as int),A.MJXH ');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
//ShowMessage(IntToStr(ADOQueryTemp.RecordCount));
|
|||
|
SCreateCDS20(ADOQueryTemp,CDS_Juan);
|
|||
|
SInitCDSData20(ADOQueryTemp,CDS_Juan);
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select MainId=Cast('''' as varchar(20)),SubId=Cast('''' as varchar(20)),');
|
|||
|
sql.Add(' PRTEColor=Cast('''' as varchar(20)),PRTHX=Cast('''' as varchar(20)),PRTColorNo=Cast('''' as varchar(20)),');
|
|||
|
sql.Add(' Lot0=Cast('''' as varchar(20)),Lot1=Cast('''' as varchar(20)),');
|
|||
|
sql.Add(' Lot2=Cast('''' as varchar(20)),Lot3=Cast('''' as varchar(20)),');
|
|||
|
sql.Add(' BaoNo=Cast('''' as varchar(20)),XH=Cast(0 as int),JJQty=Cast(0 as int),GGQty=Cast(0 as int),');
|
|||
|
sql.Add(' LenQty0=Cast(1.00 as decimal(18,1)),LenQty1=Cast(1.00 as decimal(18,1)),');
|
|||
|
sql.Add(' LenQty2=Cast(1.00 as decimal(18,1)),LenQty3=Cast(1.00 as decimal(18,1)),');
|
|||
|
sql.Add(' LenQty4=Cast(1.00 as decimal(18,1)),LenQty5=Cast(1.00 as decimal(18,1)),');
|
|||
|
sql.Add(' LenQty6=Cast(1.00 as decimal(18,1)),LenQty7=Cast(1.00 as decimal(18,1)),');
|
|||
|
sql.Add(' MZ0=Cast(1.00 as decimal(18,2)),MZ1=Cast(1.00 as decimal(18,2)),');
|
|||
|
sql.Add(' MZ2=Cast(1.00 as decimal(18,2)),MZ3=Cast(1.00 as decimal(18,2)),');
|
|||
|
sql.Add(' MZ4=Cast(1.00 as decimal(18,2)),MZ5=Cast(1.00 as decimal(18,2)),');
|
|||
|
sql.Add(' MZ6=Cast(1.00 as decimal(18,2)),MZ7=Cast(1.00 as decimal(18,2)),');
|
|||
|
sql.Add(' JZ0=Cast(1.00 as decimal(18,2)),JZ1=Cast(1.00 as decimal(18,2)),');
|
|||
|
sql.Add(' JZ2=Cast(1.00 as decimal(18,2)),JZ3=Cast(1.00 as decimal(18,2)),');
|
|||
|
sql.Add(' JZ4=Cast(1.00 as decimal(18,2)),JZ5=Cast(1.00 as decimal(18,2)),');
|
|||
|
sql.Add(' JZ6=Cast(1.00 as decimal(18,2)),JZ7=Cast(1.00 as decimal(18,2)),');
|
|||
|
sql.Add(' MJPS0=Cast(1 as int),MJPS1=Cast(1 as int),');
|
|||
|
sql.Add(' MJPS2=Cast(1 as int),MJPS3=Cast(1 as int),');
|
|||
|
sql.Add(' MJPS4=Cast(1 as int),MJPS5=Cast(1 as int),');
|
|||
|
sql.Add(' MJPS6=Cast(1 as int),MJPS7=Cast(1 as int),');
|
|||
|
sql.Add(' JH0=Cast(1 as int),JH1=Cast(1 as int),');
|
|||
|
sql.Add(' JH2=Cast(1 as int),JH3=Cast(1 as int),');
|
|||
|
sql.Add(' JH4=Cast(1 as int),JH5=Cast(1 as int),');
|
|||
|
sql.Add(' JH6=Cast(1 as int),JH7=Cast(1 as int),');
|
|||
|
sql.Add(' Hang=Cast(0 as int),');
|
|||
|
sql.Add(' Ye=Cast(0 as int),');
|
|||
|
sql.Add(' Lie=Cast(0 as int)');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryTemp,CDS_JuanPRT);
|
|||
|
SInitCDSData20(ADOQueryTemp,CDS_JuanPRT);
|
|||
|
if CDS_JuanPRT.IsEmpty=False then
|
|||
|
begin
|
|||
|
CDS_JuanPRT.Delete;
|
|||
|
end;
|
|||
|
i:=0;j:=0;z:=0;FGangNo:='';h:=0;L:=0;Y:=0;
|
|||
|
CDS_Juan.DisableControls;
|
|||
|
with CDS_Juan do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
//FHZ:=Trim(CDS_Juan.fieldbyname('SubId').AsString)+Trim(CDS_Juan.fieldbyname('BaoNO').AsString)
|
|||
|
//+Trim(CDS_Juan.fieldbyname('GangNo').AsString);
|
|||
|
with CDS_JuanPRT do
|
|||
|
begin
|
|||
|
if CDS_JuanPRT.IsEmpty then
|
|||
|
begin
|
|||
|
CDS_JuanPRT.Append;
|
|||
|
CDS_JuanPRT.FieldByName('Lot0').Value:=CDS_Juan.fieldbyname('GangNo').Value;
|
|||
|
//Lot.Items[0]:=CDS_Juan.fieldbyname('GangNo').Value;
|
|||
|
//Lot.Items[1]:='';
|
|||
|
//Lot.Items[2]:='';
|
|||
|
//Lot.Items[3]:='';
|
|||
|
CDS_JuanPRT.FieldByName('PRTEColor').Value:=CDS_Juan.fieldbyname('PRTEColor').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTColorNo').Value:=CDS_Juan.fieldbyname('PRTColorNo').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTHX').Value:=CDS_Juan.fieldbyname('PRTHX').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MJPS0').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('Hang').Value:=0;
|
|||
|
CDS_JuanPRT.FieldByName('Ye').Value:=0;
|
|||
|
CDS_JuanPRT.FieldByName('JH0').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('JH1').Value:=26;
|
|||
|
CDS_JuanPRT.FieldByName('JH2').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('JH3').Value:=26;
|
|||
|
CDS_JuanPRT.FieldByName('JH4').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('JH5').Value:=26;
|
|||
|
CDS_JuanPRT.FieldByName('JH6').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('JH7').Value:=26;
|
|||
|
CDS_JuanPRT.FieldByName('LenQty0').Value:=CDS_Juan.fieldbyname('MJLen').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MZ0').Value:=CDS_Juan.fieldbyname('MJMaoZ').Value;
|
|||
|
CDS_JuanPRT.FieldByName('JZ0').Value:=CDS_Juan.fieldbyname('MJQty4').Value;
|
|||
|
CDS_JuanPRT.FieldByName('SubId').Value:=CDS_Juan.fieldbyname('SubId').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MainId').Value:=CDS_Juan.fieldbyname('MainId').Value;
|
|||
|
CDS_JuanPRT.Post;
|
|||
|
FHZ:=Trim((CDS_Juan.fieldbyname('SubId').AsString)
|
|||
|
+Trim(CDS_Juan.fieldbyname('GangNo').AsString));
|
|||
|
FSubId:=Trim(CDS_Juan.fieldbyname('SubId').AsString);
|
|||
|
//FGangNo:=Trim(CDS_Juan.fieldbyname('GangNo').AsString);
|
|||
|
H:=0;//<2F>к<EFBFBD>
|
|||
|
L:=0;//<2F>к<EFBFBD>
|
|||
|
Y:=0;//ҳ<><D2B3>
|
|||
|
for i:=1 to 24 do
|
|||
|
begin
|
|||
|
CDS_JuanPRT.Append;
|
|||
|
CDS_JuanPRT.FieldByName('SubId').Value:=CDS_Juan.fieldbyname('SubId').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MainId').Value:=CDS_Juan.fieldbyname('MainId').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTEColor').Value:=CDS_Juan.fieldbyname('PRTEColor').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTColorNo').Value:=CDS_Juan.fieldbyname('PRTColorNo').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTHX').Value:=CDS_Juan.fieldbyname('PRTHX').Value;
|
|||
|
CDS_JuanPRT.FieldByName('JH0').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH1').Value:=26+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH2').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH3').Value:=26+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH4').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH5').Value:=26+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH6').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH7').Value:=26+i;
|
|||
|
CDS_JuanPRT.FieldByName('Lot0').Value:=CDS_Juan.fieldbyname('GangNo').Value;
|
|||
|
//CDS_JuanPRT.FieldByName('Lot0').Value:=Lot.Items[0];
|
|||
|
// CDS_JuanPRT.FieldByName('Lot1').Value:=Lot.Items[0];
|
|||
|
//CDS_JuanPRT.FieldByName('Lot2').Value:=Lot.Items[0];
|
|||
|
//CDS_JuanPRT.FieldByName('Lot3').Value:=Lot.Items[0];
|
|||
|
CDS_JuanPRT.FieldByName('Ye').Value:=Y;
|
|||
|
CDS_JuanPRT.FieldByName('Hang').Value:=i;
|
|||
|
CDS_JuanPRT.Post;
|
|||
|
end;
|
|||
|
end else //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD><DDBC><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>ɫ<EFBFBD>Ÿű<D7BA>Ϊ<EFBFBD>µġ<C2B5>
|
|||
|
begin
|
|||
|
if Trim(CDS_Juan.fieldbyname('SubId').AsString)<>Trim(FSubId) then
|
|||
|
begin
|
|||
|
CDS_JuanPRT.Append;
|
|||
|
CDS_JuanPRT.FieldByName('Lot0').Value:=CDS_Juan.fieldbyname('GangNo').Value;
|
|||
|
//Lot.Items[0]:=CDS_Juan.fieldbyname('GangNo').Value;
|
|||
|
//Lot.Items[1]:='';
|
|||
|
//Lot.Items[2]:='';
|
|||
|
//Lot.Items[3]:='';
|
|||
|
CDS_JuanPRT.FieldByName('PRTEColor').Value:=CDS_Juan.fieldbyname('PRTEColor').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTColorNo').Value:=CDS_Juan.fieldbyname('PRTColorNo').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTHX').Value:=CDS_Juan.fieldbyname('PRTHX').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MJPS0').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('Hang').Value:=0;
|
|||
|
CDS_JuanPRT.FieldByName('Ye').Value:=Y+1;
|
|||
|
CDS_JuanPRT.FieldByName('JH0').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('JH1').Value:=26;
|
|||
|
CDS_JuanPRT.FieldByName('JH2').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('JH3').Value:=26;
|
|||
|
CDS_JuanPRT.FieldByName('JH4').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('JH5').Value:=26;
|
|||
|
CDS_JuanPRT.FieldByName('JH6').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('JH7').Value:=26;
|
|||
|
CDS_JuanPRT.FieldByName('LenQty0').Value:=CDS_Juan.fieldbyname('MJLen').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MZ0').Value:=CDS_Juan.fieldbyname('MJMaoZ').Value;
|
|||
|
CDS_JuanPRT.FieldByName('JZ0').Value:=CDS_Juan.fieldbyname('MJQty4').Value;
|
|||
|
CDS_JuanPRT.FieldByName('SubId').Value:=CDS_Juan.fieldbyname('SubId').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MainId').Value:=CDS_Juan.fieldbyname('MainId').Value;
|
|||
|
//CDS_JuanPRT.FieldByName('JQty').Value:=CDS_Juan.fieldbyname('JQty').Value;
|
|||
|
//CDS_JuanPRT.FieldByName('GQty').Value:=CDS_Juan.fieldbyname('GQty').Value;
|
|||
|
CDS_JuanPRT.Post;
|
|||
|
FHZ:=Trim((CDS_Juan.fieldbyname('SubId').AsString)
|
|||
|
+Trim(CDS_Juan.fieldbyname('GangNo').AsString));
|
|||
|
FSubId:=Trim(CDS_Juan.fieldbyname('SubId').AsString);
|
|||
|
//FGangNo:=Trim(CDS_Juan.fieldbyname('GangNo').AsString);
|
|||
|
H:=0;//<2F>к<EFBFBD>
|
|||
|
L:=0;//<2F>к<EFBFBD>
|
|||
|
Y:=Y+1;//ҳ<><D2B3>
|
|||
|
for i:=1 to 24 do
|
|||
|
begin
|
|||
|
CDS_JuanPRT.Append;
|
|||
|
CDS_JuanPRT.FieldByName('SubId').Value:=CDS_Juan.fieldbyname('SubId').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MainId').Value:=CDS_Juan.fieldbyname('MainId').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTEColor').Value:=CDS_Juan.fieldbyname('PRTEColor').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTColorNo').Value:=CDS_Juan.fieldbyname('PRTColorNo').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTHX').Value:=CDS_Juan.fieldbyname('PRTHX').Value;
|
|||
|
CDS_JuanPRT.FieldByName('JH0').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH1').Value:=26+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH2').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH3').Value:=26+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH4').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH5').Value:=26+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH6').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH7').Value:=26+i;
|
|||
|
CDS_JuanPRT.FieldByName('Lot0').Value:=CDS_Juan.fieldbyname('GangNo').Value;
|
|||
|
//CDS_JuanPRT.FieldByName('Lot0').Value:=Lot.Items[0];
|
|||
|
// CDS_JuanPRT.FieldByName('Lot1').Value:=Lot.Items[0];
|
|||
|
//CDS_JuanPRT.FieldByName('Lot2').Value:=Lot.Items[0];
|
|||
|
//CDS_JuanPRT.FieldByName('Lot3').Value:=Lot.Items[0];
|
|||
|
CDS_JuanPRT.FieldByName('Ye').Value:=Y;
|
|||
|
CDS_JuanPRT.FieldByName('Hang').Value:=i;
|
|||
|
CDS_JuanPRT.Post;
|
|||
|
end;
|
|||
|
end else //subid <20><>ͬ<EFBFBD><CDAC><EFBFBD>Ų<D7BA>ͬ
|
|||
|
begin
|
|||
|
if (Trim(CDS_Juan.fieldbyname('SubId').AsString)
|
|||
|
+Trim(CDS_Juan.fieldbyname('GangNo').AsString))<>FHZ then
|
|||
|
begin
|
|||
|
if (L mod 2)=1 then
|
|||
|
L:=L+1
|
|||
|
else
|
|||
|
L:=L+2;
|
|||
|
if L<8 then
|
|||
|
begin
|
|||
|
CDS_JuanPRT.Locate('Ye;Hang', VarArrayOf([Y, 0]), [loPartialKey]);//<2F><><EFBFBD><EFBFBD><EFBFBD>к<EFBFBD>С<EFBFBD><D0A1>8 <20><>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>ǰҳ<C7B0><D2B3>һ<EFBFBD><D2BB>
|
|||
|
CDS_JuanPRT.Edit;
|
|||
|
CDS_JuanPRT.FieldByName('PRTEColor').Value:=CDS_Juan.fieldbyname('PRTEColor').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTColorNo').Value:=CDS_Juan.fieldbyname('PRTColorNo').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTHX').Value:=CDS_Juan.fieldbyname('PRTHX').Value;
|
|||
|
CDS_JuanPRT.FieldByName('Lot'+Trim(IntToStr(L div 2))).Value:=CDS_Juan.fieldbyname('GangNo').Value;
|
|||
|
//Lot.Items[L div 2]:=CDS_Juan.fieldbyname('GangNo').Value;
|
|||
|
CDS_JuanPRT.FieldByName('LenQty'+Trim(IntToStr(L))).Value:=CDS_Juan.fieldbyname('MJLen').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MZ'+Trim(IntToStr(L))).Value:=CDS_Juan.fieldbyname('MJMaoZ').Value;
|
|||
|
CDS_JuanPRT.FieldByName('JZ'+Trim(IntToStr(L))).Value:=CDS_Juan.fieldbyname('MJQty4').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MJPS'+Trim(IntToStr(L))).Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('SubId').Value:=CDS_Juan.fieldbyname('SubId').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MainId').Value:=CDS_Juan.fieldbyname('MainId').Value;
|
|||
|
CDS_JuanPRT.Post;
|
|||
|
FHZ:=Trim((CDS_Juan.fieldbyname('SubId').AsString)
|
|||
|
+Trim(CDS_Juan.fieldbyname('GangNo').AsString));
|
|||
|
FSubId:=Trim(CDS_Juan.fieldbyname('SubId').AsString);
|
|||
|
H:=0;
|
|||
|
end
|
|||
|
else //<2F><><EFBFBD><EFBFBD><EFBFBD>кŴ<D0BA><C5B4><EFBFBD>7<EFBFBD><37><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD>һҳ
|
|||
|
begin
|
|||
|
H:=0;//<2F>к<EFBFBD>
|
|||
|
L:=0;//<2F>к<EFBFBD>
|
|||
|
Y:=Y+1;//ҳ<><D2B3>
|
|||
|
CDS_JuanPRT.Append;
|
|||
|
CDS_JuanPRT.FieldByName('Lot0').Value:=CDS_Juan.fieldbyname('GangNo').Value;
|
|||
|
//Lot.Items[0]:=CDS_Juan.fieldbyname('GangNo').Value;
|
|||
|
//Lot.Items[1]:='';
|
|||
|
//Lot.Items[2]:='';
|
|||
|
//Lot.Items[3]:='';
|
|||
|
//Lot0:=Trim(CDS_Juan.fieldbyname('GangNo').AsString);
|
|||
|
CDS_JuanPRT.FieldByName('PRTEColor').Value:=CDS_Juan.fieldbyname('PRTEColor').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTColorNo').Value:=CDS_Juan.fieldbyname('PRTColorNo').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTHX').Value:=CDS_Juan.fieldbyname('PRTHX').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MJPS0').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('Hang').Value:=0;
|
|||
|
CDS_JuanPRT.FieldByName('Ye').Value:=Y;
|
|||
|
// CDS_JuanPRT.FieldByName('Lie').Value:=0;
|
|||
|
CDS_JuanPRT.FieldByName('JH0').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('JH1').Value:=26;
|
|||
|
CDS_JuanPRT.FieldByName('JH2').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('JH3').Value:=26;
|
|||
|
CDS_JuanPRT.FieldByName('JH4').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('JH5').Value:=26;
|
|||
|
CDS_JuanPRT.FieldByName('JH6').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('JH7').Value:=26;
|
|||
|
CDS_JuanPRT.FieldByName('LenQty0').Value:=CDS_Juan.fieldbyname('MJLen').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MZ0').Value:=CDS_Juan.fieldbyname('MJMaoZ').Value;
|
|||
|
CDS_JuanPRT.FieldByName('JZ0').Value:=CDS_Juan.fieldbyname('MJQty4').Value;
|
|||
|
CDS_JuanPRT.FieldByName('SubId').Value:=CDS_Juan.fieldbyname('SubId').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MainId').Value:=CDS_Juan.fieldbyname('MainId').Value;
|
|||
|
//CDS_JuanPRT.FieldByName('JQty').Value:=CDS_Juan.fieldbyname('JQty').Value;
|
|||
|
//CDS_JuanPRT.FieldByName('GQty').Value:=CDS_Juan.fieldbyname('GQty').Value;
|
|||
|
CDS_JuanPRT.Post;
|
|||
|
FHZ:=Trim(CDS_Juan.fieldbyname('SubId').AsString)
|
|||
|
+Trim(CDS_Juan.fieldbyname('GangNo').AsString);
|
|||
|
FSubId:=Trim(CDS_Juan.fieldbyname('SubId').AsString);
|
|||
|
//FGangNo:=Trim(CDS_Juan.fieldbyname('GangNo').AsString);
|
|||
|
|
|||
|
for i:=1 to 24 do
|
|||
|
begin
|
|||
|
CDS_JuanPRT.Append;
|
|||
|
CDS_JuanPRT.FieldByName('PRTEColor').Value:=CDS_Juan.fieldbyname('PRTEColor').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTColorNo').Value:=CDS_Juan.fieldbyname('PRTColorNo').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTHX').Value:=CDS_Juan.fieldbyname('PRTHX').Value;
|
|||
|
CDS_JuanPRT.FieldByName('JH0').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH1').Value:=26+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH2').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH3').Value:=26+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH4').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH5').Value:=26+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH6').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH7').Value:=26+i;
|
|||
|
//CDS_JuanPRT.FieldByName('Lot0').Value:=CDS_Juan.fieldbyname('gangno').Value;
|
|||
|
//CDS_JuanPRT.FieldByName('Lot1').Value:=Lot.Items[0];
|
|||
|
//CDS_JuanPRT.FieldByName('Lot2').Value:=Lot.Items[0];
|
|||
|
// CDS_JuanPRT.FieldByName('Lot3').Value:=Lot.Items[0];
|
|||
|
CDS_JuanPRT.FieldByName('Ye').Value:=Y;
|
|||
|
CDS_JuanPRT.FieldByName('Hang').Value:=i;
|
|||
|
CDS_JuanPRT.FieldByName('SubId').Value:=CDS_Juan.fieldbyname('SubId').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MainId').Value:=CDS_Juan.fieldbyname('MainId').Value;
|
|||
|
CDS_JuanPRT.Post;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end else //<2F><><EFBFBD>ݼ<EFBFBD><DDBC><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD><D5A3><EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>ͬ
|
|||
|
begin
|
|||
|
|
|||
|
H:=H+1;
|
|||
|
if H<25 then //<2F><><EFBFBD><EFBFBD><EFBFBD>к<EFBFBD>С<EFBFBD><D0A1>25 <20><><EFBFBD>ݼ<EFBFBD><DDBC><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD><D5A3><EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>ͬ
|
|||
|
begin
|
|||
|
CDS_JuanPRT.Locate('Ye;Hang', VarArrayOf([Y, H]), [loPartialKey]);//<2F><>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>ǰҳ<C7B0><D2B3>һ<EFBFBD><D2BB>
|
|||
|
CDS_JuanPRT.Edit;
|
|||
|
CDS_JuanPRT.FieldByName('PRTEColor').Value:=CDS_Juan.fieldbyname('PRTEColor').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTColorNo').Value:=CDS_Juan.fieldbyname('PRTColorNo').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTHX').Value:=CDS_Juan.fieldbyname('PRTHX').Value;
|
|||
|
CDS_JuanPRT.FieldByName('LenQty'+Trim(IntToStr(L))).Value:=CDS_Juan.fieldbyname('MJLen').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MZ'+Trim(IntToStr(L))).Value:=CDS_Juan.fieldbyname('MJMaoZ').Value;
|
|||
|
CDS_JuanPRT.FieldByName('JZ'+Trim(IntToStr(L))).Value:=CDS_Juan.fieldbyname('MJQty4').Value;
|
|||
|
CDS_JuanPRT.FieldByName('Lot'+Trim(IntToStr(L div 2))).Value:=CDS_Juan.fieldbyname('GangNo').Value;
|
|||
|
CDS_JuanPRT.FieldByName('SubId').Value:=CDS_Juan.fieldbyname('SubId').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MainId').Value:=CDS_Juan.fieldbyname('MainId').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MJPS'+Trim(IntToStr(L))).Value:=1;
|
|||
|
// Lot.Items[L div 2]:=CDS_Juan.fieldbyname('GangNo').Value;
|
|||
|
CDS_JuanPRT.Post;
|
|||
|
FHZ:=Trim((CDS_Juan.fieldbyname('SubId').AsString)
|
|||
|
+Trim(CDS_Juan.fieldbyname('GangNo').AsString));
|
|||
|
FSubId:=Trim(CDS_Juan.fieldbyname('SubId').AsString);
|
|||
|
end else
|
|||
|
begin //<2F><><EFBFBD><EFBFBD><EFBFBD>кŴ<D0BA><C5B4><EFBFBD>25<32><35><EFBFBD><EFBFBD><EFBFBD>л<EFBFBD><D0BB><EFBFBD> <20><><EFBFBD>ݼ<EFBFBD><DDBC><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD><D5A3><EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>ͬ
|
|||
|
H:=0;
|
|||
|
L:=L+1;
|
|||
|
{if (L mod 2)=1 then
|
|||
|
L:=L+1
|
|||
|
else
|
|||
|
L:=L+2; }
|
|||
|
if L<8 then //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD>ǰҳ <20><><EFBFBD>ݼ<EFBFBD><DDBC><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD><D5A3><EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>ͬ
|
|||
|
begin
|
|||
|
CDS_JuanPRT.Locate('Ye;Hang', VarArrayOf([Y, 0]), [loPartialKey]);//<2F><>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>ǰҳ<C7B0><D2B3>һ<EFBFBD>е<EFBFBD>һ<EFBFBD><D2BB>
|
|||
|
CDS_JuanPRT.Edit;
|
|||
|
CDS_JuanPRT.FieldByName('PRTEColor').Value:=CDS_Juan.fieldbyname('PRTEColor').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTColorNo').Value:=CDS_Juan.fieldbyname('PRTColorNo').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTHX').Value:=CDS_Juan.fieldbyname('PRTHX').Value;
|
|||
|
CDS_JuanPRT.FieldByName('LenQty'+Trim(IntToStr(L))).Value:=CDS_Juan.fieldbyname('MJLen').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MZ'+Trim(IntToStr(L))).Value:=CDS_Juan.fieldbyname('MJMaoZ').Value;
|
|||
|
CDS_JuanPRT.FieldByName('JZ'+Trim(IntToStr(L))).Value:=CDS_Juan.fieldbyname('MJQty4').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MJPS'+Trim(IntToStr(L))).Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('Lot'+Trim(IntToStr(L div 2))).Value:=CDS_Juan.fieldbyname('GangNo').Value;
|
|||
|
CDS_JuanPRT.FieldByName('SubId').Value:=CDS_Juan.fieldbyname('SubId').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MainId').Value:=CDS_Juan.fieldbyname('MainId').Value;
|
|||
|
//Lot.Items[L div 2]:=CDS_Juan.fieldbyname('GangNo').Value;
|
|||
|
CDS_JuanPRT.Post;
|
|||
|
FHZ:=Trim((CDS_Juan.fieldbyname('SubId').AsString)
|
|||
|
+Trim(CDS_Juan.fieldbyname('GangNo').AsString));
|
|||
|
FSubId:=Trim(CDS_Juan.fieldbyname('SubId').AsString);
|
|||
|
end else //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD>ǰҳ<C7B0><D2B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һҳ <20><><EFBFBD>ݼ<EFBFBD><DDBC><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD><D5A3><EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>ͬ
|
|||
|
begin
|
|||
|
CDS_JuanPRT.Append;
|
|||
|
CDS_JuanPRT.FieldByName('Lot0').Value:=CDS_Juan.fieldbyname('GangNo').Value;
|
|||
|
// Lot.Items[0]:=CDS_Juan.fieldbyname('GangNo').Value;
|
|||
|
//Lot.Items[1]:='';
|
|||
|
//Lot.Items[2]:='';
|
|||
|
//Lot.Items[3]:='';
|
|||
|
//Lot0:=Trim(CDS_Juan.fieldbyname('GangNo').AsString);
|
|||
|
CDS_JuanPRT.FieldByName('PRTEColor').Value:=CDS_Juan.fieldbyname('PRTEColor').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTColorNo').Value:=CDS_Juan.fieldbyname('PRTColorNo').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTHX').Value:=CDS_Juan.fieldbyname('PRTHX').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MJPS0').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('Hang').Value:=0;
|
|||
|
CDS_JuanPRT.FieldByName('Ye').Value:=Y+1;
|
|||
|
// CDS_JuanPRT.FieldByName('Lie').Value:=0;
|
|||
|
CDS_JuanPRT.FieldByName('JH0').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('JH1').Value:=26;
|
|||
|
CDS_JuanPRT.FieldByName('JH2').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('JH3').Value:=26;
|
|||
|
CDS_JuanPRT.FieldByName('JH4').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('JH5').Value:=26;
|
|||
|
CDS_JuanPRT.FieldByName('JH6').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('JH7').Value:=26;
|
|||
|
CDS_JuanPRT.FieldByName('LenQty0').Value:=CDS_Juan.fieldbyname('MJLen').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MZ0').Value:=CDS_Juan.fieldbyname('MJMaoZ').Value;
|
|||
|
CDS_JuanPRT.FieldByName('JZ0').Value:=CDS_Juan.fieldbyname('MJQty4').Value;
|
|||
|
CDS_JuanPRT.FieldByName('SubId').Value:=CDS_Juan.fieldbyname('SubId').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MainId').Value:=CDS_Juan.fieldbyname('MainId').Value;
|
|||
|
//CDS_JuanPRT.FieldByName('JQty').Value:=CDS_Juan.fieldbyname('JQty').Value;
|
|||
|
//CDS_JuanPRT.FieldByName('GQty').Value:=CDS_Juan.fieldbyname('GQty').Value;
|
|||
|
CDS_JuanPRT.Post;
|
|||
|
FHZ:=Trim(CDS_Juan.fieldbyname('SubId').AsString)
|
|||
|
+Trim(CDS_Juan.fieldbyname('GangNo').AsString);
|
|||
|
FSubId:=Trim(CDS_Juan.fieldbyname('SubId').AsString);
|
|||
|
//FGangNo:=Trim(CDS_Juan.fieldbyname('GangNo').AsString);
|
|||
|
H:=0;//<2F>к<EFBFBD>
|
|||
|
L:=0;//<2F>к<EFBFBD>
|
|||
|
Y:=Y+1;//ҳ<><D2B3>
|
|||
|
for i:=1 to 24 do
|
|||
|
begin
|
|||
|
CDS_JuanPRT.Append;
|
|||
|
CDS_JuanPRT.FieldByName('PRTEColor').Value:=CDS_Juan.fieldbyname('PRTEColor').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTColorNo').Value:=CDS_Juan.fieldbyname('PRTColorNo').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTHX').Value:=CDS_Juan.fieldbyname('PRTHX').Value;
|
|||
|
CDS_JuanPRT.FieldByName('JH0').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH1').Value:=26+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH2').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH3').Value:=26+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH4').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH5').Value:=26+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH6').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH7').Value:=26+i;
|
|||
|
CDS_JuanPRT.FieldByName('Lot0').Value:=Lot.Items[0];
|
|||
|
CDS_JuanPRT.FieldByName('Lot1').Value:=Lot.Items[0];
|
|||
|
CDS_JuanPRT.FieldByName('Lot2').Value:=Lot.Items[0];
|
|||
|
CDS_JuanPRT.FieldByName('Lot3').Value:=Lot.Items[0];
|
|||
|
CDS_JuanPRT.FieldByName('Ye').Value:=Y;
|
|||
|
CDS_JuanPRT.FieldByName('Hang').Value:=i;
|
|||
|
CDS_JuanPRT.FieldByName('SubId').Value:=CDS_Juan.fieldbyname('SubId').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MainId').Value:=CDS_Juan.fieldbyname('MainId').Value;
|
|||
|
CDS_JuanPRT.Post;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
end
|
|||
|
end;
|
|||
|
Next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
CDS_Juan.EnableControls;
|
|||
|
end;
|
|||
|
procedure TfrmPRTJYList.GetLotDataLie38();
|
|||
|
var
|
|||
|
i,j,z,H,q,L,Y:Integer;
|
|||
|
FGangNo,FHZ,Lot0,Lot1,Lot2,Lot3,FSubId:String;
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then Exit;
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select GangNo=MD.SelfGangNo,A.MJXH,A.MJMaoZ,A.SubId,A.MainId,A.MJQty4,');
|
|||
|
if Pos('Y',Trim(BtnEditA1.Text))>0 then
|
|||
|
begin
|
|||
|
sql.Add('MJLen=Cast(A.MJLen*1.0936 as decimal(18,1)),');
|
|||
|
end else
|
|||
|
begin
|
|||
|
sql.Add('A.MJLen,');
|
|||
|
end;
|
|||
|
sql.Add('DD.OrderNo,JS.PRTColor,PRTEColor=JS.PRTColorEng,PRTColorNo=JS.PRTColorNo,JS.PRTHX,');
|
|||
|
sql.Add(' JQty=(select Count(*) from WFB_MJJY WM where WM.SubId=JS.SubId),');
|
|||
|
sql.Add(' GQty=(select Count(*) from WFB_MJJY WM inner join JYOrder_Main_MD JMD on WM.APID=JMD.MDID ');
|
|||
|
sql.add(' where WM.SubId=JS.SubId and JMD.SelfGangNo=MD.SelfGangNo)') ;
|
|||
|
sql.Add(' from WFB_MJJY A');
|
|||
|
sql.Add(' inner join JYOrder_Main DD on A.MainId=DD.MainId');
|
|||
|
sql.Add(' inner join JYOrder_Sub JS on A.SubId=JS.SubId');
|
|||
|
sql.Add(' inner join JYOrder_Main_MD MD on A.APID=MD.MDID');
|
|||
|
sql.Add(' where A.MainId='''+Trim(CDS_Main.fieldbyname('MainId').AsString)+'''');
|
|||
|
sql.Add(' and A.ZhuangXiangSYFlag=0');
|
|||
|
//sql.Add(' and A.SubId=''JS1402100003'' ');
|
|||
|
//sql.Add(' and A.Valie=''Y'' ');
|
|||
|
if Trim(MJType.Text)<>'' then
|
|||
|
begin
|
|||
|
sql.Add(' and A.MJType='''+Trim(MJType.Text)+'''');
|
|||
|
end;
|
|||
|
sql.Add(' order by JS.SubId,Cast(MD.SelfGangNo as int),A.MJXH');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
//ShowMessage(IntToStr(ADOQueryTemp.RecordCount));
|
|||
|
SCreateCDS20(ADOQueryTemp,CDS_Juan);
|
|||
|
SInitCDSData20(ADOQueryTemp,CDS_Juan);
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select MainId=Cast('''' as varchar(20)),SubId=Cast('''' as varchar(20)),');
|
|||
|
sql.Add(' PRTEColor=Cast('''' as varchar(20)),PRTHX=Cast('''' as varchar(20)),PRTColorNo=Cast('''' as varchar(20)),');
|
|||
|
sql.Add(' Lot0=Cast('''' as varchar(20)),Lot1=Cast('''' as varchar(20)),');
|
|||
|
sql.Add(' Lot2=Cast('''' as varchar(20)),Lot3=Cast('''' as varchar(20)),');
|
|||
|
sql.Add(' Lot4=Cast('''' as varchar(20)),Lot5=Cast('''' as varchar(20)),');
|
|||
|
sql.Add(' Lot6=Cast('''' as varchar(20)),Lot7=Cast('''' as varchar(20)),');
|
|||
|
sql.Add(' BaoNo=Cast('''' as varchar(20)),XH=Cast(0 as int),JJQty=Cast(0 as int),GGQty=Cast(0 as int),');
|
|||
|
sql.Add(' LenQty0=Cast(1.00 as decimal(18,1)),LenQty1=Cast(1.00 as decimal(18,1)),');
|
|||
|
sql.Add(' LenQty2=Cast(1.00 as decimal(18,1)),LenQty3=Cast(1.00 as decimal(18,1)),');
|
|||
|
sql.Add(' LenQty4=Cast(1.00 as decimal(18,1)),LenQty5=Cast(1.00 as decimal(18,1)),');
|
|||
|
sql.Add(' LenQty6=Cast(1.00 as decimal(18,1)),LenQty7=Cast(1.00 as decimal(18,1)),');
|
|||
|
sql.Add(' MZ0=Cast(1.00 as decimal(18,2)),MZ1=Cast(1.00 as decimal(18,2)),');
|
|||
|
sql.Add(' MZ2=Cast(1.00 as decimal(18,2)),MZ3=Cast(1.00 as decimal(18,2)),');
|
|||
|
sql.Add(' MZ4=Cast(1.00 as decimal(18,2)),MZ5=Cast(1.00 as decimal(18,2)),');
|
|||
|
sql.Add(' MZ6=Cast(1.00 as decimal(18,2)),MZ7=Cast(1.00 as decimal(18,2)),');
|
|||
|
sql.Add(' JZ0=Cast(1.00 as decimal(18,2)),JZ1=Cast(1.00 as decimal(18,2)),');
|
|||
|
sql.Add(' JZ2=Cast(1.00 as decimal(18,2)),JZ3=Cast(1.00 as decimal(18,2)),');
|
|||
|
sql.Add(' JZ4=Cast(1.00 as decimal(18,2)),JZ5=Cast(1.00 as decimal(18,2)),');
|
|||
|
sql.Add(' JZ6=Cast(1.00 as decimal(18,2)),JZ7=Cast(1.00 as decimal(18,2)),');
|
|||
|
sql.Add(' MJPS0=Cast(1 as int),MJPS1=Cast(1 as int),');
|
|||
|
sql.Add(' MJPS2=Cast(1 as int),MJPS3=Cast(1 as int),');
|
|||
|
sql.Add(' MJPS4=Cast(1 as int),MJPS5=Cast(1 as int),');
|
|||
|
sql.Add(' MJPS6=Cast(1 as int),MJPS7=Cast(1 as int),');
|
|||
|
sql.Add(' JH0=Cast(1 as int),JH1=Cast(1 as int),');
|
|||
|
sql.Add(' JH2=Cast(1 as int),JH3=Cast(1 as int),');
|
|||
|
sql.Add(' JH4=Cast(1 as int),JH5=Cast(1 as int),');
|
|||
|
sql.Add(' JH6=Cast(1 as int),JH7=Cast(1 as int),');
|
|||
|
sql.Add(' Hang=Cast(0 as int),');
|
|||
|
sql.Add(' Ye=Cast(0 as int),');
|
|||
|
sql.Add(' Lie=Cast(0 as int)');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryTemp,CDS_JuanPRT);
|
|||
|
SInitCDSData20(ADOQueryTemp,CDS_JuanPRT);
|
|||
|
if CDS_JuanPRT.IsEmpty=False then
|
|||
|
begin
|
|||
|
CDS_JuanPRT.Delete;
|
|||
|
end;
|
|||
|
i:=0;j:=0;z:=0;FGangNo:='';h:=0;L:=0;Y:=0;
|
|||
|
CDS_Juan.DisableControls;
|
|||
|
with CDS_Juan do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
//FHZ:=Trim(CDS_Juan.fieldbyname('SubId').AsString)+Trim(CDS_Juan.fieldbyname('BaoNO').AsString)
|
|||
|
//+Trim(CDS_Juan.fieldbyname('GangNo').AsString);
|
|||
|
with CDS_JuanPRT do
|
|||
|
begin
|
|||
|
if CDS_JuanPRT.IsEmpty then
|
|||
|
begin
|
|||
|
CDS_JuanPRT.Append;
|
|||
|
CDS_JuanPRT.FieldByName('Lot0').Value:=CDS_Juan.fieldbyname('GangNo').Value;
|
|||
|
//Lot.Items[0]:=CDS_Juan.fieldbyname('GangNo').Value;
|
|||
|
//Lot.Items[1]:='';
|
|||
|
//Lot.Items[2]:='';
|
|||
|
//Lot.Items[3]:='';
|
|||
|
CDS_JuanPRT.FieldByName('PRTEColor').Value:=CDS_Juan.fieldbyname('PRTEColor').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTColorNo').Value:=CDS_Juan.fieldbyname('PRTColorNo').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTHX').Value:=CDS_Juan.fieldbyname('PRTHX').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MJPS0').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('Hang').Value:=0;
|
|||
|
CDS_JuanPRT.FieldByName('Ye').Value:=0;
|
|||
|
CDS_JuanPRT.FieldByName('JH0').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('JH1').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('JH2').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('JH3').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('JH4').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('JH5').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('JH6').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('JH7').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('LenQty0').Value:=CDS_Juan.fieldbyname('MJLen').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MZ0').Value:=CDS_Juan.fieldbyname('MJMaoZ').Value;
|
|||
|
CDS_JuanPRT.FieldByName('JZ0').Value:=CDS_Juan.fieldbyname('MJQty4').Value;
|
|||
|
CDS_JuanPRT.FieldByName('SubId').Value:=CDS_Juan.fieldbyname('SubId').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MainId').Value:=CDS_Juan.fieldbyname('MainId').Value;
|
|||
|
CDS_JuanPRT.Post;
|
|||
|
FHZ:=Trim((CDS_Juan.fieldbyname('SubId').AsString)
|
|||
|
+Trim(CDS_Juan.fieldbyname('GangNo').AsString));
|
|||
|
FSubId:=Trim(CDS_Juan.fieldbyname('SubId').AsString);
|
|||
|
//FGangNo:=Trim(CDS_Juan.fieldbyname('GangNo').AsString);
|
|||
|
H:=0;//<2F>к<EFBFBD>
|
|||
|
L:=0;//<2F>к<EFBFBD>
|
|||
|
Y:=0;//ҳ<><D2B3>
|
|||
|
for i:=1 to 37 do
|
|||
|
begin
|
|||
|
CDS_JuanPRT.Append;
|
|||
|
CDS_JuanPRT.FieldByName('SubId').Value:=CDS_Juan.fieldbyname('SubId').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MainId').Value:=CDS_Juan.fieldbyname('MainId').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTEColor').Value:=CDS_Juan.fieldbyname('PRTEColor').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTColorNo').Value:=CDS_Juan.fieldbyname('PRTColorNo').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTHX').Value:=CDS_Juan.fieldbyname('PRTHX').Value;
|
|||
|
CDS_JuanPRT.FieldByName('JH0').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH1').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH2').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH3').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH4').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH5').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH6').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH7').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('Lot0').Value:=CDS_Juan.fieldbyname('GangNo').Value;
|
|||
|
//CDS_JuanPRT.FieldByName('Lot0').Value:=Lot.Items[0];
|
|||
|
// CDS_JuanPRT.FieldByName('Lot1').Value:=Lot.Items[0];
|
|||
|
//CDS_JuanPRT.FieldByName('Lot2').Value:=Lot.Items[0];
|
|||
|
//CDS_JuanPRT.FieldByName('Lot3').Value:=Lot.Items[0];
|
|||
|
CDS_JuanPRT.FieldByName('Ye').Value:=Y;
|
|||
|
CDS_JuanPRT.FieldByName('Hang').Value:=i;
|
|||
|
CDS_JuanPRT.Post;
|
|||
|
end;
|
|||
|
end else //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD><DDBC><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>ɫ<EFBFBD>Ÿű<D7BA>Ϊ<EFBFBD>µġ<C2B5>
|
|||
|
begin
|
|||
|
if Trim(CDS_Juan.fieldbyname('SubId').AsString)<>Trim(FSubId) then
|
|||
|
begin
|
|||
|
CDS_JuanPRT.Append;
|
|||
|
CDS_JuanPRT.FieldByName('Lot0').Value:=CDS_Juan.fieldbyname('GangNo').Value;
|
|||
|
//Lot.Items[0]:=CDS_Juan.fieldbyname('GangNo').Value;
|
|||
|
//Lot.Items[1]:='';
|
|||
|
//Lot.Items[2]:='';
|
|||
|
//Lot.Items[3]:='';
|
|||
|
CDS_JuanPRT.FieldByName('PRTEColor').Value:=CDS_Juan.fieldbyname('PRTEColor').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTColorNo').Value:=CDS_Juan.fieldbyname('PRTColorNo').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTHX').Value:=CDS_Juan.fieldbyname('PRTHX').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MJPS0').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('Hang').Value:=0;
|
|||
|
CDS_JuanPRT.FieldByName('Ye').Value:=Y+1;
|
|||
|
CDS_JuanPRT.FieldByName('JH0').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('JH1').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('JH2').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('JH3').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('JH4').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('JH5').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('JH6').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('JH7').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('LenQty0').Value:=CDS_Juan.fieldbyname('MJLen').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MZ0').Value:=CDS_Juan.fieldbyname('MJMaoZ').Value;
|
|||
|
CDS_JuanPRT.FieldByName('JZ0').Value:=CDS_Juan.fieldbyname('MJQty4').Value;
|
|||
|
CDS_JuanPRT.FieldByName('SubId').Value:=CDS_Juan.fieldbyname('SubId').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MainId').Value:=CDS_Juan.fieldbyname('MainId').Value;
|
|||
|
//CDS_JuanPRT.FieldByName('JQty').Value:=CDS_Juan.fieldbyname('JQty').Value;
|
|||
|
//CDS_JuanPRT.FieldByName('GQty').Value:=CDS_Juan.fieldbyname('GQty').Value;
|
|||
|
CDS_JuanPRT.Post;
|
|||
|
FHZ:=Trim((CDS_Juan.fieldbyname('SubId').AsString)
|
|||
|
+Trim(CDS_Juan.fieldbyname('GangNo').AsString));
|
|||
|
FSubId:=Trim(CDS_Juan.fieldbyname('SubId').AsString);
|
|||
|
//FGangNo:=Trim(CDS_Juan.fieldbyname('GangNo').AsString);
|
|||
|
H:=0;//<2F>к<EFBFBD>
|
|||
|
L:=0;//<2F>к<EFBFBD>
|
|||
|
Y:=Y+1;//ҳ<><D2B3>
|
|||
|
for i:=1 to 37 do
|
|||
|
begin
|
|||
|
CDS_JuanPRT.Append;
|
|||
|
CDS_JuanPRT.FieldByName('SubId').Value:=CDS_Juan.fieldbyname('SubId').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MainId').Value:=CDS_Juan.fieldbyname('MainId').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTEColor').Value:=CDS_Juan.fieldbyname('PRTEColor').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTColorNo').Value:=CDS_Juan.fieldbyname('PRTColorNo').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTHX').Value:=CDS_Juan.fieldbyname('PRTHX').Value;
|
|||
|
CDS_JuanPRT.FieldByName('JH0').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH1').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH2').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH3').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH4').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH5').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH6').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH7').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('Lot0').Value:=CDS_Juan.fieldbyname('GangNo').Value;
|
|||
|
//CDS_JuanPRT.FieldByName('Lot0').Value:=Lot.Items[0];
|
|||
|
// CDS_JuanPRT.FieldByName('Lot1').Value:=Lot.Items[0];
|
|||
|
//CDS_JuanPRT.FieldByName('Lot2').Value:=Lot.Items[0];
|
|||
|
//CDS_JuanPRT.FieldByName('Lot3').Value:=Lot.Items[0];
|
|||
|
CDS_JuanPRT.FieldByName('Ye').Value:=Y;
|
|||
|
CDS_JuanPRT.FieldByName('Hang').Value:=i;
|
|||
|
CDS_JuanPRT.Post;
|
|||
|
end;
|
|||
|
end else //subid <20><>ͬ<EFBFBD><CDAC><EFBFBD>Ų<D7BA>ͬ
|
|||
|
begin
|
|||
|
if (Trim(CDS_Juan.fieldbyname('SubId').AsString)
|
|||
|
+Trim(CDS_Juan.fieldbyname('GangNo').AsString))<>FHZ then
|
|||
|
begin
|
|||
|
L:=L+1;
|
|||
|
if L<8 then
|
|||
|
begin
|
|||
|
CDS_JuanPRT.Locate('Ye;Hang', VarArrayOf([Y, 0]), [loPartialKey]);//<2F><><EFBFBD><EFBFBD><EFBFBD>к<EFBFBD>С<EFBFBD><D0A1>8 <20><>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>ǰҳ<C7B0><D2B3>һ<EFBFBD><D2BB>
|
|||
|
CDS_JuanPRT.Edit;
|
|||
|
CDS_JuanPRT.FieldByName('PRTEColor').Value:=CDS_Juan.fieldbyname('PRTEColor').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTColorNo').Value:=CDS_Juan.fieldbyname('PRTColorNo').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTHX').Value:=CDS_Juan.fieldbyname('PRTHX').Value;
|
|||
|
CDS_JuanPRT.FieldByName('Lot'+Trim(IntToStr(L))).Value:=CDS_Juan.fieldbyname('GangNo').Value;
|
|||
|
//Lot.Items[L div 2]:=CDS_Juan.fieldbyname('GangNo').Value;
|
|||
|
CDS_JuanPRT.FieldByName('LenQty'+Trim(IntToStr(L))).Value:=CDS_Juan.fieldbyname('MJLen').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MZ'+Trim(IntToStr(L))).Value:=CDS_Juan.fieldbyname('MJMaoZ').Value;
|
|||
|
CDS_JuanPRT.FieldByName('JZ'+Trim(IntToStr(L))).Value:=CDS_Juan.fieldbyname('MJQty4').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MJPS'+Trim(IntToStr(L))).Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('SubId').Value:=CDS_Juan.fieldbyname('SubId').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MainId').Value:=CDS_Juan.fieldbyname('MainId').Value;
|
|||
|
CDS_JuanPRT.Post;
|
|||
|
FHZ:=Trim((CDS_Juan.fieldbyname('SubId').AsString)
|
|||
|
+Trim(CDS_Juan.fieldbyname('GangNo').AsString));
|
|||
|
FSubId:=Trim(CDS_Juan.fieldbyname('SubId').AsString);
|
|||
|
H:=0;
|
|||
|
end
|
|||
|
else //<2F><><EFBFBD><EFBFBD><EFBFBD>кŴ<D0BA><C5B4><EFBFBD>7<EFBFBD><37><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD>һҳ
|
|||
|
begin
|
|||
|
H:=0;//<2F>к<EFBFBD>
|
|||
|
L:=0;//<2F>к<EFBFBD>
|
|||
|
Y:=Y+1;//ҳ<><D2B3>
|
|||
|
CDS_JuanPRT.Append;
|
|||
|
CDS_JuanPRT.FieldByName('Lot0').Value:=CDS_Juan.fieldbyname('GangNo').Value;
|
|||
|
//Lot.Items[0]:=CDS_Juan.fieldbyname('GangNo').Value;
|
|||
|
//Lot.Items[1]:='';
|
|||
|
//Lot.Items[2]:='';
|
|||
|
//Lot.Items[3]:='';
|
|||
|
//Lot0:=Trim(CDS_Juan.fieldbyname('GangNo').AsString);
|
|||
|
CDS_JuanPRT.FieldByName('PRTEColor').Value:=CDS_Juan.fieldbyname('PRTEColor').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTColorNo').Value:=CDS_Juan.fieldbyname('PRTColorNo').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTHX').Value:=CDS_Juan.fieldbyname('PRTHX').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MJPS0').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('Hang').Value:=0;
|
|||
|
CDS_JuanPRT.FieldByName('Ye').Value:=Y;
|
|||
|
// CDS_JuanPRT.FieldByName('Lie').Value:=0;
|
|||
|
CDS_JuanPRT.FieldByName('JH0').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('JH1').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('JH2').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('JH3').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('JH4').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('JH5').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('JH6').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('JH7').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('LenQty0').Value:=CDS_Juan.fieldbyname('MJLen').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MZ0').Value:=CDS_Juan.fieldbyname('MJMaoZ').Value;
|
|||
|
CDS_JuanPRT.FieldByName('JZ0').Value:=CDS_Juan.fieldbyname('MJQty4').Value;
|
|||
|
CDS_JuanPRT.FieldByName('SubId').Value:=CDS_Juan.fieldbyname('SubId').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MainId').Value:=CDS_Juan.fieldbyname('MainId').Value;
|
|||
|
//CDS_JuanPRT.FieldByName('JQty').Value:=CDS_Juan.fieldbyname('JQty').Value;
|
|||
|
//CDS_JuanPRT.FieldByName('GQty').Value:=CDS_Juan.fieldbyname('GQty').Value;
|
|||
|
CDS_JuanPRT.Post;
|
|||
|
FHZ:=Trim(CDS_Juan.fieldbyname('SubId').AsString)
|
|||
|
+Trim(CDS_Juan.fieldbyname('GangNo').AsString);
|
|||
|
FSubId:=Trim(CDS_Juan.fieldbyname('SubId').AsString);
|
|||
|
//FGangNo:=Trim(CDS_Juan.fieldbyname('GangNo').AsString);
|
|||
|
|
|||
|
for i:=1 to 37 do
|
|||
|
begin
|
|||
|
CDS_JuanPRT.Append;
|
|||
|
CDS_JuanPRT.FieldByName('PRTEColor').Value:=CDS_Juan.fieldbyname('PRTEColor').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTColorNo').Value:=CDS_Juan.fieldbyname('PRTColorNo').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTHX').Value:=CDS_Juan.fieldbyname('PRTHX').Value;
|
|||
|
CDS_JuanPRT.FieldByName('JH0').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH1').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH2').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH3').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH4').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH5').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH6').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH7').Value:=1+i;
|
|||
|
//CDS_JuanPRT.FieldByName('Lot0').Value:=CDS_Juan.fieldbyname('gangno').Value;
|
|||
|
//CDS_JuanPRT.FieldByName('Lot1').Value:=Lot.Items[0];
|
|||
|
//CDS_JuanPRT.FieldByName('Lot2').Value:=Lot.Items[0];
|
|||
|
// CDS_JuanPRT.FieldByName('Lot3').Value:=Lot.Items[0];
|
|||
|
CDS_JuanPRT.FieldByName('Ye').Value:=Y;
|
|||
|
CDS_JuanPRT.FieldByName('Hang').Value:=i;
|
|||
|
CDS_JuanPRT.FieldByName('SubId').Value:=CDS_Juan.fieldbyname('SubId').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MainId').Value:=CDS_Juan.fieldbyname('MainId').Value;
|
|||
|
CDS_JuanPRT.Post;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end else //<2F><><EFBFBD>ݼ<EFBFBD><DDBC><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD><D5A3><EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>ͬ
|
|||
|
begin
|
|||
|
|
|||
|
H:=H+1;
|
|||
|
if H<38 then //<2F><><EFBFBD><EFBFBD><EFBFBD>к<EFBFBD>С<EFBFBD><D0A1>38 <20><><EFBFBD>ݼ<EFBFBD><DDBC><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD><D5A3><EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>ͬ
|
|||
|
begin
|
|||
|
CDS_JuanPRT.Locate('Ye;Hang', VarArrayOf([Y, H]), [loPartialKey]);//<2F><>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>ǰҳ<C7B0><D2B3>һ<EFBFBD><D2BB>
|
|||
|
CDS_JuanPRT.Edit;
|
|||
|
CDS_JuanPRT.FieldByName('PRTEColor').Value:=CDS_Juan.fieldbyname('PRTEColor').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTColorNo').Value:=CDS_Juan.fieldbyname('PRTColorNo').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTHX').Value:=CDS_Juan.fieldbyname('PRTHX').Value;
|
|||
|
CDS_JuanPRT.FieldByName('LenQty'+Trim(IntToStr(L))).Value:=CDS_Juan.fieldbyname('MJLen').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MZ'+Trim(IntToStr(L))).Value:=CDS_Juan.fieldbyname('MJMaoZ').Value;
|
|||
|
CDS_JuanPRT.FieldByName('JZ'+Trim(IntToStr(L))).Value:=CDS_Juan.fieldbyname('MJQty4').Value;
|
|||
|
CDS_JuanPRT.FieldByName('Lot'+Trim(IntToStr(L))).Value:=CDS_Juan.fieldbyname('GangNo').Value;
|
|||
|
CDS_JuanPRT.FieldByName('SubId').Value:=CDS_Juan.fieldbyname('SubId').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MainId').Value:=CDS_Juan.fieldbyname('MainId').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MJPS'+Trim(IntToStr(L))).Value:=1;
|
|||
|
// Lot.Items[L div 2]:=CDS_Juan.fieldbyname('GangNo').Value;
|
|||
|
CDS_JuanPRT.Post;
|
|||
|
FHZ:=Trim((CDS_Juan.fieldbyname('SubId').AsString)
|
|||
|
+Trim(CDS_Juan.fieldbyname('GangNo').AsString));
|
|||
|
FSubId:=Trim(CDS_Juan.fieldbyname('SubId').AsString);
|
|||
|
end else
|
|||
|
begin //<2F><><EFBFBD><EFBFBD><EFBFBD>кŴ<D0BA><C5B4><EFBFBD>38<33><38><EFBFBD><EFBFBD><EFBFBD>л<EFBFBD><D0BB><EFBFBD> <20><><EFBFBD>ݼ<EFBFBD><DDBC><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD><D5A3><EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>ͬ
|
|||
|
H:=0;
|
|||
|
L:=L+1;
|
|||
|
{if (L mod 2)=1 then
|
|||
|
L:=L+1
|
|||
|
else
|
|||
|
L:=L+2; }
|
|||
|
if L<8 then //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD>ǰҳ <20><><EFBFBD>ݼ<EFBFBD><DDBC><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD><D5A3><EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>ͬ
|
|||
|
begin
|
|||
|
CDS_JuanPRT.Locate('Ye;Hang', VarArrayOf([Y, 0]), [loPartialKey]);//<2F><>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>ǰҳ<C7B0><D2B3>һ<EFBFBD>е<EFBFBD>һ<EFBFBD><D2BB>
|
|||
|
CDS_JuanPRT.Edit;
|
|||
|
CDS_JuanPRT.FieldByName('PRTEColor').Value:=CDS_Juan.fieldbyname('PRTEColor').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTColorNo').Value:=CDS_Juan.fieldbyname('PRTColorNo').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTHX').Value:=CDS_Juan.fieldbyname('PRTHX').Value;
|
|||
|
CDS_JuanPRT.FieldByName('LenQty'+Trim(IntToStr(L))).Value:=CDS_Juan.fieldbyname('MJLen').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MZ'+Trim(IntToStr(L))).Value:=CDS_Juan.fieldbyname('MJMaoZ').Value;
|
|||
|
CDS_JuanPRT.FieldByName('JZ'+Trim(IntToStr(L))).Value:=CDS_Juan.fieldbyname('MJQty4').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MJPS'+Trim(IntToStr(L))).Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('Lot'+Trim(IntToStr(L))).Value:=CDS_Juan.fieldbyname('GangNo').Value;
|
|||
|
CDS_JuanPRT.FieldByName('SubId').Value:=CDS_Juan.fieldbyname('SubId').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MainId').Value:=CDS_Juan.fieldbyname('MainId').Value;
|
|||
|
//Lot.Items[L div 2]:=CDS_Juan.fieldbyname('GangNo').Value;
|
|||
|
CDS_JuanPRT.Post;
|
|||
|
FHZ:=Trim((CDS_Juan.fieldbyname('SubId').AsString)
|
|||
|
+Trim(CDS_Juan.fieldbyname('GangNo').AsString));
|
|||
|
FSubId:=Trim(CDS_Juan.fieldbyname('SubId').AsString);
|
|||
|
end else //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD>ǰҳ<C7B0><D2B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һҳ <20><><EFBFBD>ݼ<EFBFBD><DDBC><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD><D5A3><EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>ͬ
|
|||
|
begin
|
|||
|
CDS_JuanPRT.Append;
|
|||
|
CDS_JuanPRT.FieldByName('Lot0').Value:=CDS_Juan.fieldbyname('GangNo').Value;
|
|||
|
// Lot.Items[0]:=CDS_Juan.fieldbyname('GangNo').Value;
|
|||
|
//Lot.Items[1]:='';
|
|||
|
//Lot.Items[2]:='';
|
|||
|
//Lot.Items[3]:='';
|
|||
|
//Lot0:=Trim(CDS_Juan.fieldbyname('GangNo').AsString);
|
|||
|
CDS_JuanPRT.FieldByName('PRTEColor').Value:=CDS_Juan.fieldbyname('PRTEColor').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTColorNo').Value:=CDS_Juan.fieldbyname('PRTColorNo').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTHX').Value:=CDS_Juan.fieldbyname('PRTHX').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MJPS0').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('Hang').Value:=0;
|
|||
|
CDS_JuanPRT.FieldByName('Ye').Value:=Y+1;
|
|||
|
// CDS_JuanPRT.FieldByName('Lie').Value:=0;
|
|||
|
CDS_JuanPRT.FieldByName('JH0').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('JH1').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('JH2').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('JH3').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('JH4').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('JH5').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('JH6').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('JH7').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('LenQty0').Value:=CDS_Juan.fieldbyname('MJLen').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MZ0').Value:=CDS_Juan.fieldbyname('MJMaoZ').Value;
|
|||
|
CDS_JuanPRT.FieldByName('JZ0').Value:=CDS_Juan.fieldbyname('MJQty4').Value;
|
|||
|
CDS_JuanPRT.FieldByName('SubId').Value:=CDS_Juan.fieldbyname('SubId').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MainId').Value:=CDS_Juan.fieldbyname('MainId').Value;
|
|||
|
//CDS_JuanPRT.FieldByName('JQty').Value:=CDS_Juan.fieldbyname('JQty').Value;
|
|||
|
//CDS_JuanPRT.FieldByName('GQty').Value:=CDS_Juan.fieldbyname('GQty').Value;
|
|||
|
CDS_JuanPRT.Post;
|
|||
|
FHZ:=Trim(CDS_Juan.fieldbyname('SubId').AsString)
|
|||
|
+Trim(CDS_Juan.fieldbyname('GangNo').AsString);
|
|||
|
FSubId:=Trim(CDS_Juan.fieldbyname('SubId').AsString);
|
|||
|
//FGangNo:=Trim(CDS_Juan.fieldbyname('GangNo').AsString);
|
|||
|
H:=0;//<2F>к<EFBFBD>
|
|||
|
L:=0;//<2F>к<EFBFBD>
|
|||
|
Y:=Y+1;//ҳ<><D2B3>
|
|||
|
for i:=1 to 37 do
|
|||
|
begin
|
|||
|
CDS_JuanPRT.Append;
|
|||
|
CDS_JuanPRT.FieldByName('PRTEColor').Value:=CDS_Juan.fieldbyname('PRTEColor').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTColorNo').Value:=CDS_Juan.fieldbyname('PRTColorNo').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTHX').Value:=CDS_Juan.fieldbyname('PRTHX').Value;
|
|||
|
CDS_JuanPRT.FieldByName('JH0').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH1').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH2').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH3').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH4').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH5').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH6').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH7').Value:=1+i;
|
|||
|
//CDS_JuanPRT.FieldByName('Lot0').Value:=Lot.Items[0];
|
|||
|
//CDS_JuanPRT.FieldByName('Lot1').Value:=Lot.Items[0];
|
|||
|
//CDS_JuanPRT.FieldByName('Lot2').Value:=Lot.Items[0];
|
|||
|
//CDS_JuanPRT.FieldByName('Lot3').Value:=Lot.Items[0];
|
|||
|
CDS_JuanPRT.FieldByName('Ye').Value:=Y;
|
|||
|
CDS_JuanPRT.FieldByName('Hang').Value:=i;
|
|||
|
CDS_JuanPRT.FieldByName('SubId').Value:=CDS_Juan.fieldbyname('SubId').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MainId').Value:=CDS_Juan.fieldbyname('MainId').Value;
|
|||
|
CDS_JuanPRT.Post;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
|
|||
|
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
end
|
|||
|
end;
|
|||
|
Next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
CDS_Juan.EnableControls;
|
|||
|
end;
|
|||
|
procedure TfrmPRTJYList.GetLotDataLie38Ye();//<2F><>ҳ<EFBFBD><D2B3>
|
|||
|
var
|
|||
|
i,j,z,H,q,L,Y:Integer;
|
|||
|
FGangNo,FHZ,Lot0,Lot1,Lot2,Lot3,FSubId:String;
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then Exit;
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select GangNo=MD.SelfGangNo,A.MJXH,A.MJMaoZ,A.SubId,A.MainId,A.MJQty4,');
|
|||
|
if Pos('Y',Trim(BtnEditA1.Text))>0 then
|
|||
|
begin
|
|||
|
//sql.Add('MJLen=Cast(A.MJLen*1.0936 as decimal(18,1)),');
|
|||
|
sql.Add(' Case when isnull(A.MJLenMa,-1)=-1 then Cast(A.MJLen*1.0936 as decimal(18,1)) else Cast(A.MJLenMa*1 as decimal(18,1)) end as MJLen ');
|
|||
|
end else
|
|||
|
begin
|
|||
|
sql.Add('A.MJLen,');
|
|||
|
end;
|
|||
|
sql.Add('DD.OrderNo,JS.PRTColor,PRTEColor=JS.PRTColorEng,PRTColorNo=JS.PRTColorNo,JS.PRTHX,');
|
|||
|
sql.Add(' JQty=(select Count(*) from WFB_MJJY WM where WM.SubId=JS.SubId),');
|
|||
|
sql.Add(' GQty=(select Count(*) from WFB_MJJY WM inner join JYOrder_Main_MD JMD on WM.APID=JMD.MDID ');
|
|||
|
sql.add(' where WM.SubId=JS.SubId and JMD.SelfGangNo=MD.SelfGangNo)') ;
|
|||
|
sql.Add(' from WFB_MJJY A');
|
|||
|
sql.Add(' inner join JYOrder_Main DD on A.MainId=DD.MainId');
|
|||
|
sql.Add(' inner join JYOrder_Sub JS on A.SubId=JS.SubId');
|
|||
|
sql.Add(' inner join JYOrder_Main_MD MD on A.APID=MD.MDID');
|
|||
|
sql.Add(' where A.MainId='''+Trim(CDS_Main.fieldbyname('MainId').AsString)+'''');
|
|||
|
//sql.Add(' and A.ZhuangXiangSYFlag=0');
|
|||
|
if CheckBox1.Checked=False then
|
|||
|
sql.Add(' and A.ZhuangXiangSYFlag=0')
|
|||
|
else
|
|||
|
sql.Add(' and A.ZhuangXiangSYFlag=1');
|
|||
|
//sql.Add(' and A.SubId=''JS1402100003'' ');
|
|||
|
//sql.Add(' and A.Valie=''Y'' ');
|
|||
|
if Trim(MJType.Text)<>'' then
|
|||
|
begin
|
|||
|
sql.Add(' and A.MJType='''+Trim(MJType.Text)+'''');
|
|||
|
end;
|
|||
|
sql.Add(' order by JS.SubId,Cast(MD.SelfGangNo as int),A.MJXH');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
//ShowMessage(IntToStr(ADOQueryTemp.RecordCount));
|
|||
|
SCreateCDS20(ADOQueryTemp,CDS_Juan);
|
|||
|
SInitCDSData20(ADOQueryTemp,CDS_Juan);
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select MainId=Cast('''' as varchar(20)),SubId=Cast('''' as varchar(20)),');
|
|||
|
sql.Add(' PRTEColor=Cast('''' as varchar(20)),PRTHX=Cast('''' as varchar(20)),PRTColorNo=Cast('''' as varchar(20)),');
|
|||
|
sql.Add(' Lot0=Cast('''' as varchar(20)),Lot1=Cast('''' as varchar(20)),');
|
|||
|
sql.Add(' Lot2=Cast('''' as varchar(20)),Lot3=Cast('''' as varchar(20)),');
|
|||
|
sql.Add(' Lot4=Cast('''' as varchar(20)),Lot5=Cast('''' as varchar(20)),');
|
|||
|
sql.Add(' Lot6=Cast('''' as varchar(20)),Lot7=Cast('''' as varchar(20)),');
|
|||
|
sql.Add(' CoL0=Cast('''' as varchar(80)),CoL1=Cast('''' as varchar(80)),');
|
|||
|
sql.Add(' CoL2=Cast('''' as varchar(80)),CoL3=Cast('''' as varchar(80)),');
|
|||
|
sql.Add(' CoL4=Cast('''' as varchar(80)),CoL5=Cast('''' as varchar(80)),');
|
|||
|
sql.Add(' CoL6=Cast('''' as varchar(80)),CoL7=Cast('''' as varchar(80)),');
|
|||
|
sql.Add(' BaoNo=Cast('''' as varchar(20)),XH=Cast(0 as int),JJQty=Cast(0 as int),GGQty=Cast(0 as int),');
|
|||
|
sql.Add(' LenQty0=Cast(1.00 as decimal(18,1)),LenQty1=Cast(1.00 as decimal(18,1)),');
|
|||
|
sql.Add(' LenQty2=Cast(1.00 as decimal(18,1)),LenQty3=Cast(1.00 as decimal(18,1)),');
|
|||
|
sql.Add(' LenQty4=Cast(1.00 as decimal(18,1)),LenQty5=Cast(1.00 as decimal(18,1)),');
|
|||
|
sql.Add(' LenQty6=Cast(1.00 as decimal(18,1)),LenQty7=Cast(1.00 as decimal(18,1)),');
|
|||
|
sql.Add(' MZ0=Cast(1.00 as decimal(18,2)),MZ1=Cast(1.00 as decimal(18,2)),');
|
|||
|
sql.Add(' MZ2=Cast(1.00 as decimal(18,2)),MZ3=Cast(1.00 as decimal(18,2)),');
|
|||
|
sql.Add(' MZ4=Cast(1.00 as decimal(18,2)),MZ5=Cast(1.00 as decimal(18,2)),');
|
|||
|
sql.Add(' MZ6=Cast(1.00 as decimal(18,2)),MZ7=Cast(1.00 as decimal(18,2)),');
|
|||
|
sql.Add(' JZ0=Cast(1.00 as decimal(18,2)),JZ1=Cast(1.00 as decimal(18,2)),');
|
|||
|
sql.Add(' JZ2=Cast(1.00 as decimal(18,2)),JZ3=Cast(1.00 as decimal(18,2)),');
|
|||
|
sql.Add(' JZ4=Cast(1.00 as decimal(18,2)),JZ5=Cast(1.00 as decimal(18,2)),');
|
|||
|
sql.Add(' JZ6=Cast(1.00 as decimal(18,2)),JZ7=Cast(1.00 as decimal(18,2)),');
|
|||
|
sql.Add(' MJPS0=Cast(1 as int),MJPS1=Cast(1 as int),');
|
|||
|
sql.Add(' MJPS2=Cast(1 as int),MJPS3=Cast(1 as int),');
|
|||
|
sql.Add(' MJPS4=Cast(1 as int),MJPS5=Cast(1 as int),');
|
|||
|
sql.Add(' MJPS6=Cast(1 as int),MJPS7=Cast(1 as int),');
|
|||
|
sql.Add(' JH0=Cast(1 as int),JH1=Cast(1 as int),');
|
|||
|
sql.Add(' JH2=Cast(1 as int),JH3=Cast(1 as int),');
|
|||
|
sql.Add(' JH4=Cast(1 as int),JH5=Cast(1 as int),');
|
|||
|
sql.Add(' JH6=Cast(1 as int),JH7=Cast(1 as int),');
|
|||
|
sql.Add(' Hang=Cast(0 as int),');
|
|||
|
sql.Add(' Ye=Cast(0 as int),');
|
|||
|
sql.Add(' Lie=Cast(0 as int)');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryTemp,CDS_JuanPRT);
|
|||
|
SInitCDSData20(ADOQueryTemp,CDS_JuanPRT);
|
|||
|
if CDS_JuanPRT.IsEmpty=False then
|
|||
|
begin
|
|||
|
CDS_JuanPRT.Delete;
|
|||
|
end;
|
|||
|
i:=0;j:=0;z:=0;FGangNo:='';h:=0;L:=0;Y:=0;
|
|||
|
CDS_Juan.DisableControls;
|
|||
|
with CDS_Juan do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
//FHZ:=Trim(CDS_Juan.fieldbyname('SubId').AsString)+Trim(CDS_Juan.fieldbyname('BaoNO').AsString)
|
|||
|
//+Trim(CDS_Juan.fieldbyname('GangNo').AsString);
|
|||
|
with CDS_JuanPRT do
|
|||
|
begin
|
|||
|
if CDS_JuanPRT.IsEmpty then
|
|||
|
begin
|
|||
|
CDS_JuanPRT.Append;
|
|||
|
CDS_JuanPRT.FieldByName('Lot0').Value:=CDS_Juan.fieldbyname('GangNo').Value;
|
|||
|
//Lot.Items[0]:=CDS_Juan.fieldbyname('GangNo').Value;
|
|||
|
//Lot.Items[1]:='';
|
|||
|
//Lot.Items[2]:='';
|
|||
|
//Lot.Items[3]:='';
|
|||
|
CDS_JuanPRT.FieldByName('PRTEColor').Value:=CDS_Juan.fieldbyname('PRTEColor').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTColorNo').Value:=CDS_Juan.fieldbyname('PRTColorNo').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTHX').Value:=CDS_Juan.fieldbyname('PRTHX').Value;
|
|||
|
CDS_JuanPRT.FieldByName('CoL0').Value:=Trim(CDS_Juan.fieldbyname('PRTColorNo').AsString)
|
|||
|
+' '+Trim(CDS_Juan.fieldbyname('PRTEColor').AsString)
|
|||
|
+' '+Trim(CDS_Juan.fieldbyname('PRTHX').AsString);
|
|||
|
CDS_JuanPRT.FieldByName('MJPS0').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('Hang').Value:=0;
|
|||
|
CDS_JuanPRT.FieldByName('Ye').Value:=0;
|
|||
|
CDS_JuanPRT.FieldByName('JH0').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('JH1').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('JH2').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('JH3').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('JH4').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('JH5').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('JH6').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('JH7').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('LenQty0').Value:=CDS_Juan.fieldbyname('MJLen').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MZ0').Value:=CDS_Juan.fieldbyname('MJMaoZ').Value;
|
|||
|
CDS_JuanPRT.FieldByName('JZ0').Value:=CDS_Juan.fieldbyname('MJQty4').Value;
|
|||
|
CDS_JuanPRT.FieldByName('SubId').Value:=CDS_Juan.fieldbyname('SubId').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MainId').Value:=CDS_Juan.fieldbyname('MainId').Value;
|
|||
|
CDS_JuanPRT.Post;
|
|||
|
FHZ:=Trim((CDS_Juan.fieldbyname('SubId').AsString)
|
|||
|
+Trim(CDS_Juan.fieldbyname('GangNo').AsString));
|
|||
|
FSubId:=Trim(CDS_Juan.fieldbyname('SubId').AsString);
|
|||
|
//FGangNo:=Trim(CDS_Juan.fieldbyname('GangNo').AsString);
|
|||
|
H:=0;//<2F>к<EFBFBD>
|
|||
|
L:=0;//<2F>к<EFBFBD>
|
|||
|
Y:=0;//ҳ<><D2B3>
|
|||
|
for i:=1 to 37 do
|
|||
|
begin
|
|||
|
CDS_JuanPRT.Append;
|
|||
|
{CDS_JuanPRT.FieldByName('SubId').Value:=CDS_Juan.fieldbyname('SubId').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MainId').Value:=CDS_Juan.fieldbyname('MainId').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTEColor').Value:=CDS_Juan.fieldbyname('PRTEColor').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTColorNo').Value:=CDS_Juan.fieldbyname('PRTColorNo').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTHX').Value:=CDS_Juan.fieldbyname('PRTHX').Value; }
|
|||
|
CDS_JuanPRT.FieldByName('JH0').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH1').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH2').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH3').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH4').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH5').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH6').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH7').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('Lot0').Value:=CDS_Juan.fieldbyname('GangNo').Value;
|
|||
|
CDS_JuanPRT.FieldByName('CoL0').Value:=Trim(CDS_Juan.fieldbyname('PRTColorNo').AsString)
|
|||
|
+' '+Trim(CDS_Juan.fieldbyname('PRTEColor').AsString)
|
|||
|
+' '+Trim(CDS_Juan.fieldbyname('PRTHX').AsString);
|
|||
|
//CDS_JuanPRT.FieldByName('Lot0').Value:=Lot.Items[0];
|
|||
|
// CDS_JuanPRT.FieldByName('Lot1').Value:=Lot.Items[0];
|
|||
|
//CDS_JuanPRT.FieldByName('Lot2').Value:=Lot.Items[0];
|
|||
|
//CDS_JuanPRT.FieldByName('Lot3').Value:=Lot.Items[0];
|
|||
|
CDS_JuanPRT.FieldByName('Ye').Value:=Y;
|
|||
|
CDS_JuanPRT.FieldByName('Hang').Value:=i;
|
|||
|
CDS_JuanPRT.Post;
|
|||
|
end;
|
|||
|
end else //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݼ<EFBFBD><DDBC><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD>ɫ<EFBFBD>Ÿű<D7BA>Ϊ<EFBFBD>µġ<C2B5>
|
|||
|
begin
|
|||
|
if Trim(CDS_Juan.fieldbyname('SubId').AsString)<>Trim(FSubId) then
|
|||
|
begin
|
|||
|
L:=L+1;
|
|||
|
if L<8 then
|
|||
|
begin
|
|||
|
CDS_JuanPRT.Locate('Ye;Hang', VarArrayOf([Y, 0]), [loPartialKey]);//<2F><><EFBFBD><EFBFBD><EFBFBD>к<EFBFBD>С<EFBFBD><D0A1>8 <20><>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>ǰҳ<C7B0><D2B3>һ<EFBFBD><D2BB>
|
|||
|
CDS_JuanPRT.Edit;
|
|||
|
CDS_JuanPRT.FieldByName('PRTEColor').Value:=CDS_Juan.fieldbyname('PRTEColor').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTColorNo').Value:=CDS_Juan.fieldbyname('PRTColorNo').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTHX').Value:=CDS_Juan.fieldbyname('PRTHX').Value;
|
|||
|
CDS_JuanPRT.FieldByName('Lot'+Trim(IntToStr(L))).Value:=CDS_Juan.fieldbyname('GangNo').Value;
|
|||
|
CDS_JuanPRT.FieldByName('CoL'+Trim(IntToStr(L))).Value:=Trim(CDS_Juan.fieldbyname('PRTColorNo').AsString)
|
|||
|
+' '+Trim(CDS_Juan.fieldbyname('PRTEColor').AsString)
|
|||
|
+' '+Trim(CDS_Juan.fieldbyname('PRTHX').AsString);
|
|||
|
//Lot.Items[L div 2]:=CDS_Juan.fieldbyname('GangNo').Value;
|
|||
|
CDS_JuanPRT.FieldByName('LenQty'+Trim(IntToStr(L))).Value:=CDS_Juan.fieldbyname('MJLen').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MZ'+Trim(IntToStr(L))).Value:=CDS_Juan.fieldbyname('MJMaoZ').Value;
|
|||
|
CDS_JuanPRT.FieldByName('JZ'+Trim(IntToStr(L))).Value:=CDS_Juan.fieldbyname('MJQty4').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MJPS'+Trim(IntToStr(L))).Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('SubId').Value:=CDS_Juan.fieldbyname('SubId').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MainId').Value:=CDS_Juan.fieldbyname('MainId').Value;
|
|||
|
CDS_JuanPRT.Post;
|
|||
|
FHZ:=Trim((CDS_Juan.fieldbyname('SubId').AsString)
|
|||
|
+Trim(CDS_Juan.fieldbyname('GangNo').AsString));
|
|||
|
FSubId:=Trim(CDS_Juan.fieldbyname('SubId').AsString);
|
|||
|
H:=0;
|
|||
|
end else //<2F><><EFBFBD><EFBFBD>һҳ
|
|||
|
begin
|
|||
|
CDS_JuanPRT.Append;
|
|||
|
CDS_JuanPRT.FieldByName('Lot0').Value:=CDS_Juan.fieldbyname('GangNo').Value;
|
|||
|
CDS_JuanPRT.FieldByName('CoL0').Value:=Trim(CDS_Juan.fieldbyname('PRTColorNo').AsString)
|
|||
|
+' '+Trim(CDS_Juan.fieldbyname('PRTEColor').AsString)
|
|||
|
+' '+Trim(CDS_Juan.fieldbyname('PRTHX').AsString);
|
|||
|
//Lot.Items[0]:=CDS_Juan.fieldbyname('GangNo').Value;
|
|||
|
//Lot.Items[1]:='';
|
|||
|
//Lot.Items[2]:='';
|
|||
|
//Lot.Items[3]:='';
|
|||
|
CDS_JuanPRT.FieldByName('PRTEColor').Value:=CDS_Juan.fieldbyname('PRTEColor').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTColorNo').Value:=CDS_Juan.fieldbyname('PRTColorNo').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTHX').Value:=CDS_Juan.fieldbyname('PRTHX').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MJPS0').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('Hang').Value:=0;
|
|||
|
CDS_JuanPRT.FieldByName('Ye').Value:=Y+1;
|
|||
|
CDS_JuanPRT.FieldByName('JH0').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('JH1').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('JH2').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('JH3').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('JH4').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('JH5').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('JH6').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('JH7').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('LenQty0').Value:=CDS_Juan.fieldbyname('MJLen').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MZ0').Value:=CDS_Juan.fieldbyname('MJMaoZ').Value;
|
|||
|
CDS_JuanPRT.FieldByName('JZ0').Value:=CDS_Juan.fieldbyname('MJQty4').Value;
|
|||
|
CDS_JuanPRT.FieldByName('SubId').Value:=CDS_Juan.fieldbyname('SubId').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MainId').Value:=CDS_Juan.fieldbyname('MainId').Value;
|
|||
|
//CDS_JuanPRT.FieldByName('JQty').Value:=CDS_Juan.fieldbyname('JQty').Value;
|
|||
|
//CDS_JuanPRT.FieldByName('GQty').Value:=CDS_Juan.fieldbyname('GQty').Value;
|
|||
|
CDS_JuanPRT.Post;
|
|||
|
FHZ:=Trim((CDS_Juan.fieldbyname('SubId').AsString)
|
|||
|
+Trim(CDS_Juan.fieldbyname('GangNo').AsString));
|
|||
|
FSubId:=Trim(CDS_Juan.fieldbyname('SubId').AsString);
|
|||
|
//FGangNo:=Trim(CDS_Juan.fieldbyname('GangNo').AsString);
|
|||
|
H:=0;//<2F>к<EFBFBD>
|
|||
|
L:=0;//<2F>к<EFBFBD>
|
|||
|
Y:=Y+1;//ҳ<><D2B3>
|
|||
|
for i:=1 to 37 do
|
|||
|
begin
|
|||
|
CDS_JuanPRT.Append;
|
|||
|
{ CDS_JuanPRT.FieldByName('SubId').Value:=CDS_Juan.fieldbyname('SubId').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MainId').Value:=CDS_Juan.fieldbyname('MainId').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTEColor').Value:=CDS_Juan.fieldbyname('PRTEColor').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTColorNo').Value:=CDS_Juan.fieldbyname('PRTColorNo').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTHX').Value:=CDS_Juan.fieldbyname('PRTHX').Value; }
|
|||
|
CDS_JuanPRT.FieldByName('JH0').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH1').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH2').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH3').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH4').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH5').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH6').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH7').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('Lot0').Value:=CDS_Juan.fieldbyname('GangNo').Value;
|
|||
|
CDS_JuanPRT.FieldByName('CoL0').Value:=Trim(CDS_Juan.fieldbyname('PRTColorNo').AsString)
|
|||
|
+' '+Trim(CDS_Juan.fieldbyname('PRTEColor').AsString)
|
|||
|
+' '+Trim(CDS_Juan.fieldbyname('PRTHX').AsString);
|
|||
|
//CDS_JuanPRT.FieldByName('Lot0').Value:=Lot.Items[0];
|
|||
|
// CDS_JuanPRT.FieldByName('Lot1').Value:=Lot.Items[0];
|
|||
|
//CDS_JuanPRT.FieldByName('Lot2').Value:=Lot.Items[0];
|
|||
|
//CDS_JuanPRT.FieldByName('Lot3').Value:=Lot.Items[0];
|
|||
|
CDS_JuanPRT.FieldByName('Ye').Value:=Y;
|
|||
|
CDS_JuanPRT.FieldByName('Hang').Value:=i;
|
|||
|
CDS_JuanPRT.Post;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
end else //subid <20><>ͬ<EFBFBD><CDAC><EFBFBD>Ų<D7BA>ͬ
|
|||
|
begin
|
|||
|
if (Trim(CDS_Juan.fieldbyname('SubId').AsString)
|
|||
|
+Trim(CDS_Juan.fieldbyname('GangNo').AsString))<>FHZ then
|
|||
|
begin
|
|||
|
L:=L+1;
|
|||
|
if L<8 then
|
|||
|
begin
|
|||
|
CDS_JuanPRT.Locate('Ye;Hang', VarArrayOf([Y, 0]), [loPartialKey]);//<2F><><EFBFBD><EFBFBD><EFBFBD>к<EFBFBD>С<EFBFBD><D0A1>8 <20><>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>ǰҳ<C7B0><D2B3>һ<EFBFBD><D2BB>
|
|||
|
CDS_JuanPRT.Edit;
|
|||
|
CDS_JuanPRT.FieldByName('PRTEColor').Value:=CDS_Juan.fieldbyname('PRTEColor').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTColorNo').Value:=CDS_Juan.fieldbyname('PRTColorNo').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTHX').Value:=CDS_Juan.fieldbyname('PRTHX').Value;
|
|||
|
CDS_JuanPRT.FieldByName('Lot'+Trim(IntToStr(L))).Value:=CDS_Juan.fieldbyname('GangNo').Value;
|
|||
|
CDS_JuanPRT.FieldByName('CoL'+Trim(IntToStr(L))).Value:=Trim(CDS_Juan.fieldbyname('PRTColorNo').AsString)
|
|||
|
+' '+Trim(CDS_Juan.fieldbyname('PRTEColor').AsString)
|
|||
|
+' '+Trim(CDS_Juan.fieldbyname('PRTHX').AsString);
|
|||
|
//Lot.Items[L div 2]:=CDS_Juan.fieldbyname('GangNo').Value;
|
|||
|
CDS_JuanPRT.FieldByName('LenQty'+Trim(IntToStr(L))).Value:=CDS_Juan.fieldbyname('MJLen').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MZ'+Trim(IntToStr(L))).Value:=CDS_Juan.fieldbyname('MJMaoZ').Value;
|
|||
|
CDS_JuanPRT.FieldByName('JZ'+Trim(IntToStr(L))).Value:=CDS_Juan.fieldbyname('MJQty4').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MJPS'+Trim(IntToStr(L))).Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('SubId').Value:=CDS_Juan.fieldbyname('SubId').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MainId').Value:=CDS_Juan.fieldbyname('MainId').Value;
|
|||
|
CDS_JuanPRT.Post;
|
|||
|
FHZ:=Trim((CDS_Juan.fieldbyname('SubId').AsString)
|
|||
|
+Trim(CDS_Juan.fieldbyname('GangNo').AsString));
|
|||
|
FSubId:=Trim(CDS_Juan.fieldbyname('SubId').AsString);
|
|||
|
H:=0;
|
|||
|
end
|
|||
|
else //<2F><><EFBFBD><EFBFBD><EFBFBD>кŴ<D0BA><C5B4><EFBFBD>7<EFBFBD><37><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD>һҳ
|
|||
|
begin
|
|||
|
H:=0;//<2F>к<EFBFBD>
|
|||
|
L:=0;//<2F>к<EFBFBD>
|
|||
|
Y:=Y+1;//ҳ<><D2B3>
|
|||
|
CDS_JuanPRT.Append;
|
|||
|
CDS_JuanPRT.FieldByName('Lot0').Value:=CDS_Juan.fieldbyname('GangNo').Value;
|
|||
|
CDS_JuanPRT.FieldByName('CoL0').Value:=Trim(CDS_Juan.fieldbyname('PRTColorNo').AsString)
|
|||
|
+' '+Trim(CDS_Juan.fieldbyname('PRTEColor').AsString)
|
|||
|
+' '+Trim(CDS_Juan.fieldbyname('PRTHX').AsString);
|
|||
|
//Lot.Items[0]:=CDS_Juan.fieldbyname('GangNo').Value;
|
|||
|
//Lot.Items[1]:='';
|
|||
|
//Lot.Items[2]:='';
|
|||
|
//Lot.Items[3]:='';
|
|||
|
//Lot0:=Trim(CDS_Juan.fieldbyname('GangNo').AsString);
|
|||
|
CDS_JuanPRT.FieldByName('PRTEColor').Value:=CDS_Juan.fieldbyname('PRTEColor').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTColorNo').Value:=CDS_Juan.fieldbyname('PRTColorNo').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTHX').Value:=CDS_Juan.fieldbyname('PRTHX').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MJPS0').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('Hang').Value:=0;
|
|||
|
CDS_JuanPRT.FieldByName('Ye').Value:=Y;
|
|||
|
// CDS_JuanPRT.FieldByName('Lie').Value:=0;
|
|||
|
CDS_JuanPRT.FieldByName('JH0').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('JH1').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('JH2').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('JH3').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('JH4').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('JH5').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('JH6').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('JH7').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('LenQty0').Value:=CDS_Juan.fieldbyname('MJLen').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MZ0').Value:=CDS_Juan.fieldbyname('MJMaoZ').Value;
|
|||
|
CDS_JuanPRT.FieldByName('JZ0').Value:=CDS_Juan.fieldbyname('MJQty4').Value;
|
|||
|
CDS_JuanPRT.FieldByName('SubId').Value:=CDS_Juan.fieldbyname('SubId').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MainId').Value:=CDS_Juan.fieldbyname('MainId').Value;
|
|||
|
//CDS_JuanPRT.FieldByName('JQty').Value:=CDS_Juan.fieldbyname('JQty').Value;
|
|||
|
//CDS_JuanPRT.FieldByName('GQty').Value:=CDS_Juan.fieldbyname('GQty').Value;
|
|||
|
CDS_JuanPRT.Post;
|
|||
|
FHZ:=Trim(CDS_Juan.fieldbyname('SubId').AsString)
|
|||
|
+Trim(CDS_Juan.fieldbyname('GangNo').AsString);
|
|||
|
FSubId:=Trim(CDS_Juan.fieldbyname('SubId').AsString);
|
|||
|
//FGangNo:=Trim(CDS_Juan.fieldbyname('GangNo').AsString);
|
|||
|
|
|||
|
for i:=1 to 37 do
|
|||
|
begin
|
|||
|
CDS_JuanPRT.Append;
|
|||
|
{CDS_JuanPRT.FieldByName('PRTEColor').Value:=CDS_Juan.fieldbyname('PRTEColor').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTColorNo').Value:=CDS_Juan.fieldbyname('PRTColorNo').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTHX').Value:=CDS_Juan.fieldbyname('PRTHX').Value; }
|
|||
|
CDS_JuanPRT.FieldByName('JH0').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH1').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH2').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH3').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH4').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH5').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH6').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH7').Value:=1+i;
|
|||
|
//CDS_JuanPRT.FieldByName('Lot0').Value:=CDS_Juan.fieldbyname('gangno').Value;
|
|||
|
//CDS_JuanPRT.FieldByName('Lot1').Value:=Lot.Items[0];
|
|||
|
//CDS_JuanPRT.FieldByName('Lot2').Value:=Lot.Items[0];
|
|||
|
// CDS_JuanPRT.FieldByName('Lot3').Value:=Lot.Items[0];
|
|||
|
CDS_JuanPRT.FieldByName('Ye').Value:=Y;
|
|||
|
CDS_JuanPRT.FieldByName('Hang').Value:=i;
|
|||
|
{ CDS_JuanPRT.FieldByName('SubId').Value:=CDS_Juan.fieldbyname('SubId').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MainId').Value:=CDS_Juan.fieldbyname('MainId').Value;}
|
|||
|
CDS_JuanPRT.Post;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end else //<2F><><EFBFBD>ݼ<EFBFBD><DDBC><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD><D5A3><EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>ͬ
|
|||
|
begin
|
|||
|
|
|||
|
H:=H+1;
|
|||
|
if H<38 then //<2F><><EFBFBD><EFBFBD><EFBFBD>к<EFBFBD>С<EFBFBD><D0A1>38 <20><><EFBFBD>ݼ<EFBFBD><DDBC><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD><D5A3><EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>ͬ
|
|||
|
begin
|
|||
|
CDS_JuanPRT.Locate('Ye;Hang', VarArrayOf([Y, H]), [loPartialKey]);//<2F><>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>ǰҳ<C7B0><D2B3>һ<EFBFBD><D2BB>
|
|||
|
CDS_JuanPRT.Edit;
|
|||
|
CDS_JuanPRT.FieldByName('PRTEColor').Value:=CDS_Juan.fieldbyname('PRTEColor').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTColorNo').Value:=CDS_Juan.fieldbyname('PRTColorNo').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTHX').Value:=CDS_Juan.fieldbyname('PRTHX').Value;
|
|||
|
CDS_JuanPRT.FieldByName('LenQty'+Trim(IntToStr(L))).Value:=CDS_Juan.fieldbyname('MJLen').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MZ'+Trim(IntToStr(L))).Value:=CDS_Juan.fieldbyname('MJMaoZ').Value;
|
|||
|
CDS_JuanPRT.FieldByName('JZ'+Trim(IntToStr(L))).Value:=CDS_Juan.fieldbyname('MJQty4').Value;
|
|||
|
CDS_JuanPRT.FieldByName('Lot'+Trim(IntToStr(L))).Value:=CDS_Juan.fieldbyname('GangNo').Value;
|
|||
|
CDS_JuanPRT.FieldByName('CoL'+Trim(IntToStr(L))).Value:=Trim(CDS_Juan.fieldbyname('PRTColorNo').AsString)
|
|||
|
+' '+Trim(CDS_Juan.fieldbyname('PRTEColor').AsString)
|
|||
|
+' '+Trim(CDS_Juan.fieldbyname('PRTHX').AsString);
|
|||
|
CDS_JuanPRT.FieldByName('SubId').Value:=CDS_Juan.fieldbyname('SubId').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MainId').Value:=CDS_Juan.fieldbyname('MainId').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MJPS'+Trim(IntToStr(L))).Value:=1;
|
|||
|
// Lot.Items[L div 2]:=CDS_Juan.fieldbyname('GangNo').Value;
|
|||
|
CDS_JuanPRT.Post;
|
|||
|
FHZ:=Trim((CDS_Juan.fieldbyname('SubId').AsString)
|
|||
|
+Trim(CDS_Juan.fieldbyname('GangNo').AsString));
|
|||
|
FSubId:=Trim(CDS_Juan.fieldbyname('SubId').AsString);
|
|||
|
end else
|
|||
|
begin //<2F><><EFBFBD><EFBFBD><EFBFBD>кŴ<D0BA><C5B4><EFBFBD>38<33><38><EFBFBD><EFBFBD><EFBFBD>л<EFBFBD><D0BB><EFBFBD> <20><><EFBFBD>ݼ<EFBFBD><DDBC><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD><D5A3><EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>ͬ
|
|||
|
H:=0;
|
|||
|
L:=L+1;
|
|||
|
{if (L mod 2)=1 then
|
|||
|
L:=L+1
|
|||
|
else
|
|||
|
L:=L+2; }
|
|||
|
if L<8 then //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD>ǰҳ <20><><EFBFBD>ݼ<EFBFBD><DDBC><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD><D5A3><EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>ͬ
|
|||
|
begin
|
|||
|
CDS_JuanPRT.Locate('Ye;Hang', VarArrayOf([Y, 0]), [loPartialKey]);//<2F><>λ<EFBFBD><CEBB><EFBFBD><EFBFBD>ǰҳ<C7B0><D2B3>һ<EFBFBD>е<EFBFBD>һ<EFBFBD><D2BB>
|
|||
|
CDS_JuanPRT.Edit;
|
|||
|
CDS_JuanPRT.FieldByName('PRTEColor').Value:=CDS_Juan.fieldbyname('PRTEColor').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTColorNo').Value:=CDS_Juan.fieldbyname('PRTColorNo').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTHX').Value:=CDS_Juan.fieldbyname('PRTHX').Value;
|
|||
|
CDS_JuanPRT.FieldByName('LenQty'+Trim(IntToStr(L))).Value:=CDS_Juan.fieldbyname('MJLen').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MZ'+Trim(IntToStr(L))).Value:=CDS_Juan.fieldbyname('MJMaoZ').Value;
|
|||
|
CDS_JuanPRT.FieldByName('JZ'+Trim(IntToStr(L))).Value:=CDS_Juan.fieldbyname('MJQty4').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MJPS'+Trim(IntToStr(L))).Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('Lot'+Trim(IntToStr(L))).Value:=CDS_Juan.fieldbyname('GangNo').Value;
|
|||
|
CDS_JuanPRT.FieldByName('CoL'+Trim(IntToStr(L))).Value:=Trim(CDS_Juan.fieldbyname('PRTColorNo').AsString)
|
|||
|
+' '+Trim(CDS_Juan.fieldbyname('PRTEColor').AsString)
|
|||
|
+' '+Trim(CDS_Juan.fieldbyname('PRTHX').AsString);
|
|||
|
CDS_JuanPRT.FieldByName('SubId').Value:=CDS_Juan.fieldbyname('SubId').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MainId').Value:=CDS_Juan.fieldbyname('MainId').Value;
|
|||
|
//Lot.Items[L div 2]:=CDS_Juan.fieldbyname('GangNo').Value;
|
|||
|
CDS_JuanPRT.Post;
|
|||
|
FHZ:=Trim((CDS_Juan.fieldbyname('SubId').AsString)
|
|||
|
+Trim(CDS_Juan.fieldbyname('GangNo').AsString));
|
|||
|
FSubId:=Trim(CDS_Juan.fieldbyname('SubId').AsString);
|
|||
|
end else //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD>ǰҳ<C7B0><D2B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һҳ <20><><EFBFBD>ݼ<EFBFBD><DDBC><EFBFBD>Ϊ<EFBFBD>գ<EFBFBD><D5A3><EFBFBD>ɫ<EFBFBD><C9AB><EFBFBD><EFBFBD>ͬ
|
|||
|
begin
|
|||
|
CDS_JuanPRT.Append;
|
|||
|
CDS_JuanPRT.FieldByName('Lot0').Value:=CDS_Juan.fieldbyname('GangNo').Value;
|
|||
|
CDS_JuanPRT.FieldByName('CoL0').Value:=Trim(CDS_Juan.fieldbyname('PRTColorNo').AsString)
|
|||
|
+' '+Trim(CDS_Juan.fieldbyname('PRTEColor').AsString)
|
|||
|
+' '+Trim(CDS_Juan.fieldbyname('PRTHX').AsString);
|
|||
|
// Lot.Items[0]:=CDS_Juan.fieldbyname('GangNo').Value;
|
|||
|
//Lot.Items[1]:='';
|
|||
|
//Lot.Items[2]:='';
|
|||
|
//Lot.Items[3]:='';
|
|||
|
//Lot0:=Trim(CDS_Juan.fieldbyname('GangNo').AsString);
|
|||
|
CDS_JuanPRT.FieldByName('PRTEColor').Value:=CDS_Juan.fieldbyname('PRTEColor').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTColorNo').Value:=CDS_Juan.fieldbyname('PRTColorNo').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTHX').Value:=CDS_Juan.fieldbyname('PRTHX').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MJPS0').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('Hang').Value:=0;
|
|||
|
CDS_JuanPRT.FieldByName('Ye').Value:=Y+1;
|
|||
|
// CDS_JuanPRT.FieldByName('Lie').Value:=0;
|
|||
|
CDS_JuanPRT.FieldByName('JH0').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('JH1').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('JH2').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('JH3').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('JH4').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('JH5').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('JH6').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('JH7').Value:=1;
|
|||
|
CDS_JuanPRT.FieldByName('LenQty0').Value:=CDS_Juan.fieldbyname('MJLen').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MZ0').Value:=CDS_Juan.fieldbyname('MJMaoZ').Value;
|
|||
|
CDS_JuanPRT.FieldByName('JZ0').Value:=CDS_Juan.fieldbyname('MJQty4').Value;
|
|||
|
CDS_JuanPRT.FieldByName('SubId').Value:=CDS_Juan.fieldbyname('SubId').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MainId').Value:=CDS_Juan.fieldbyname('MainId').Value;
|
|||
|
//CDS_JuanPRT.FieldByName('JQty').Value:=CDS_Juan.fieldbyname('JQty').Value;
|
|||
|
//CDS_JuanPRT.FieldByName('GQty').Value:=CDS_Juan.fieldbyname('GQty').Value;
|
|||
|
CDS_JuanPRT.Post;
|
|||
|
FHZ:=Trim(CDS_Juan.fieldbyname('SubId').AsString)
|
|||
|
+Trim(CDS_Juan.fieldbyname('GangNo').AsString);
|
|||
|
FSubId:=Trim(CDS_Juan.fieldbyname('SubId').AsString);
|
|||
|
//FGangNo:=Trim(CDS_Juan.fieldbyname('GangNo').AsString);
|
|||
|
H:=0;//<2F>к<EFBFBD>
|
|||
|
L:=0;//<2F>к<EFBFBD>
|
|||
|
Y:=Y+1;//ҳ<><D2B3>
|
|||
|
for i:=1 to 37 do
|
|||
|
begin
|
|||
|
CDS_JuanPRT.Append;
|
|||
|
{CDS_JuanPRT.FieldByName('PRTEColor').Value:=CDS_Juan.fieldbyname('PRTEColor').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTColorNo').Value:=CDS_Juan.fieldbyname('PRTColorNo').Value;
|
|||
|
CDS_JuanPRT.FieldByName('PRTHX').Value:=CDS_Juan.fieldbyname('PRTHX').Value;}
|
|||
|
CDS_JuanPRT.FieldByName('JH0').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH1').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH2').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH3').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH4').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH5').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH6').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('JH7').Value:=1+i;
|
|||
|
CDS_JuanPRT.FieldByName('Ye').Value:=Y;
|
|||
|
CDS_JuanPRT.FieldByName('Hang').Value:=i;
|
|||
|
{CDS_JuanPRT.FieldByName('SubId').Value:=CDS_Juan.fieldbyname('SubId').Value;
|
|||
|
CDS_JuanPRT.FieldByName('MainId').Value:=CDS_Juan.fieldbyname('MainId').Value; }
|
|||
|
CDS_JuanPRT.Post;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end
|
|||
|
end;
|
|||
|
Next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
CDS_Juan.EnableControls;
|
|||
|
end;
|
|||
|
procedure TfrmPRTJYList.ToolButton1Click(Sender: TObject);
|
|||
|
var
|
|||
|
fPrintFile:String;
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then Exit;
|
|||
|
if Trim(BtnEditA1.Text)='' then
|
|||
|
begin
|
|||
|
Application.MessageBox('<27>뵥<EFBFBD><EBB5A5><EFBFBD>Ʋ<EFBFBD><C6B2><EFBFBD>Ϊ<EFBFBD><CEAA>!','<27><>ʾ',0);
|
|||
|
Exit;
|
|||
|
end;
|
|||
|
fPrintFile:= ExtractFilePath(Application.ExeName) + 'Report\'+Trim(BtnEditA1.Text)+'.rmf' ;
|
|||
|
Panel2.Visible:=True;
|
|||
|
Panel2.Refresh;
|
|||
|
if Trim(BtnEditA1.Text)='ͨ<><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>뵥(<28><EFBFBD><D7BA><EFBFBD>)' then
|
|||
|
begin
|
|||
|
GetLotDataLie();
|
|||
|
end else
|
|||
|
if Trim(BtnEditA1.Text)='ͨ<><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>뵥(<28><EFBFBD>38<33><38>)' then
|
|||
|
begin
|
|||
|
//GetLotDataLie38();
|
|||
|
GetLotDataLie38Ye();
|
|||
|
end else
|
|||
|
if Trim(BtnEditA1.Text)='ͨ<><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>뵥(<28><EFBFBD>38<33><38>M)' then
|
|||
|
begin
|
|||
|
//GetLotDataLie38();
|
|||
|
GetLotDataLie38Ye();
|
|||
|
end else
|
|||
|
begin
|
|||
|
GetLotData();
|
|||
|
end;
|
|||
|
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.add('select AAA.*,JSM.OrderNo,JSB.PRTColorEng,JSB.PRTHX,JSB.PRTColorNo,JSB.PRTOrdQty,');
|
|||
|
sql.Add('DifLv=Cast((MJJingZ-PRTOrdQty)*1.00*100/PRTOrdQty as decimal(18,2))');
|
|||
|
sql.Add(' from(');
|
|||
|
sql.Add('select Sum(MJLen) MQty,Sum(YQty) YQty,Count(*) PS,Sum(MJQty4) MJJingZ,Sum(MJMaoZ) MJMaoZ ,SubId');
|
|||
|
SQL.Add('from (select A.MJLen,A.MJQty4,A.MJMaoZ,A.SubId,');
|
|||
|
sql.Add(' Case when isnull(A.MJLenMa,-1)<=0 then Cast(A.MJLen*1.0936 as decimal(18,1)) else Cast(A.MJLenMa*1 as decimal(18,1)) end as YQty ');
|
|||
|
//sql.Add('GangNo=(select GangNo from JYOrder_Main_MD B where B.MDID=A.APID),A.Subid');
|
|||
|
sql.Add(' from WFB_MJJY A');
|
|||
|
sql.Add(' inner join JYOrder_Main DD on A.MainId=DD.MainId');
|
|||
|
sql.Add(' where A.MainId='''+Trim(CDS_Main.fieldbyname('MainId').AsString)+'''');
|
|||
|
//sql.Add(' and A.ZhuangXiangSYFlag=0');
|
|||
|
if CheckBox1.Checked=False then
|
|||
|
sql.Add(' and A.ZhuangXiangSYFlag=0')
|
|||
|
else
|
|||
|
sql.Add(' and A.ZhuangXiangSYFlag=1');
|
|||
|
if Trim(MJType.Text)<>'' then
|
|||
|
begin
|
|||
|
SQL.Add(' and A.MJType='''+Trim(MJType.Text)+''' )AA ');
|
|||
|
end else
|
|||
|
begin
|
|||
|
SQL.Add(' and 1=1 )AA');
|
|||
|
end;
|
|||
|
sql.Add('Group by SubId)AAA');
|
|||
|
sql.add(' inner join JYOrder_Sub JSB on AAA.SubId=JSB.SubID');
|
|||
|
sql.Add(' inner join JYOrder_Main JSM on JSB.MainId=JSM.MainId');
|
|||
|
sql.add(' order by SubId');
|
|||
|
//ShowMessage(SQL.Text);
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryCmd,CDS_HZ);
|
|||
|
SInitCDSData20(ADOQueryCmd,CDS_HZ);
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select sum(MJLen) MQty,Cast(sum(MJLen)*1.0936 as decimal(18,1)) YQty, ');
|
|||
|
sql.Add(' sum(MJMaoZ) MaoZ,sum(MJQty4) JingZ,Count(*) PS');
|
|||
|
sql.Add(' from WFB_MJJY where MainId='''+Trim(CDS_Main.fieldbyname('MainId').AsString)+'''');
|
|||
|
if CheckBox1.Checked=False then
|
|||
|
sql.Add(' and ZhuangXiangSYFlag=0')
|
|||
|
else
|
|||
|
sql.Add(' and ZhuangXiangSYFlag=1');
|
|||
|
if Trim(MJType.Text)<>'' then
|
|||
|
begin
|
|||
|
SQL.Add(' and MJType='''+Trim(MJType.Text)+'''');
|
|||
|
end;
|
|||
|
sql.Add(' group by MainId');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
Panel2.Visible:=False;
|
|||
|
if FileExists(fPrintFile) then
|
|||
|
begin
|
|||
|
RMVariables['OrderNo']:=Trim(CDS_Main.fieldbyname('OrderNo').AsString);
|
|||
|
RMVariables['MPRTCode']:=Trim(CDS_Main.fieldbyname('MPRTCode').AsString);
|
|||
|
RMVariables['MQty']:=ADOQueryTemp.fieldbyname('MQty').Value;
|
|||
|
RMVariables['MaoZ']:=ADOQueryTemp.fieldbyname('MaoZ').Value;
|
|||
|
RMVariables['JingZ']:=ADOQueryTemp.fieldbyname('JingZ').Value;
|
|||
|
RMVariables['PS']:=ADOQueryTemp.fieldbyname('PS').Value;
|
|||
|
// RMVariables['QtyUnit']:=Trim(CDS_Main.fieldbyname('QtyUnit').AsString);
|
|||
|
RM3.LoadFromFile(fPrintFile);
|
|||
|
RM3.ShowReport;
|
|||
|
end else
|
|||
|
begin
|
|||
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>'+ExtractFilePath(Application.ExeName)+'Report\'+Trim(BtnEditA1.Text)+'.rmf'),'<27><>ʾ',0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPRTJYList.BtnEditA1BtnClick(Sender: TObject);
|
|||
|
begin
|
|||
|
try
|
|||
|
frmZDYHelp:=TfrmZDYHelp.Create(Application);
|
|||
|
with frmZDYHelp do
|
|||
|
begin
|
|||
|
flag:='CKMD';
|
|||
|
flagname:='<27><><EFBFBD><EFBFBD><EFBFBD>뵥';
|
|||
|
if ShowModal=1 then
|
|||
|
begin
|
|||
|
BtnEditA1.Text:=Trim(ClientDataSet1.fieldbyname('ZdyName').AsString);
|
|||
|
end;
|
|||
|
end;
|
|||
|
finally
|
|||
|
frmZDYHelp.Free;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPRTJYList.Panel10MouseMove(Sender: TObject;
|
|||
|
Shift: TShiftState; X, Y: Integer);
|
|||
|
begin
|
|||
|
ReleaseCapture;
|
|||
|
TWinControl(Panel4).Perform(WM_SYSCOMMAND,$F012,0);
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPRTJYList.Tv1CellDblClick(Sender: TcxCustomGridTableView;
|
|||
|
ACellViewInfo: TcxGridTableDataCellViewInfo; AButton: TMouseButton;
|
|||
|
AShift: TShiftState; var AHandled: Boolean);
|
|||
|
begin
|
|||
|
Panel4.Left:=FLeft;
|
|||
|
Panel4.Top:=FTop+110;
|
|||
|
Panel4.Visible:=True;
|
|||
|
Panel4.Refresh;
|
|||
|
Panel10.Caption:=Trim(TV1.Controller.FocusedColumn.Caption);
|
|||
|
RichEdit1.Text:=CDS_Main.fieldbyname(TV1.Controller.FocusedColumn.DataBinding.FilterFieldName).AsString;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPRTJYList.Image2Click(Sender: TObject);
|
|||
|
begin
|
|||
|
Panel4.Visible:=False;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPRTJYList.Tv1MouseUp(Sender: TObject; Button: TMouseButton;
|
|||
|
Shift: TShiftState; X, Y: Integer);
|
|||
|
begin
|
|||
|
FLeft:=X;
|
|||
|
FTop:=Y;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPRTJYList.v1Column24PropertiesEditValueChanged(
|
|||
|
Sender: TObject);
|
|||
|
var
|
|||
|
mvalue:string;
|
|||
|
begin
|
|||
|
mvalue:=TcxTextEdit(Sender).EditingText;
|
|||
|
with CDS_Main do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
FieldByName('SeLaoDu').Value:=Trim(mvalue);
|
|||
|
post;
|
|||
|
end;
|
|||
|
with ADOQueryCmd do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('Update WFB_MJJY Set SeLaoDu='''+Trim(mvalue)+'''');
|
|||
|
sql.Add(' where MJID='''+Trim(CDS_Main.fieldbyname('MJID').AsString)+'''');
|
|||
|
ExecSQL;
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
procedure TfrmPRTJYList.ToolButton3Click(Sender: TObject);
|
|||
|
var
|
|||
|
fPrintFile:String;
|
|||
|
begin
|
|||
|
if CDS_Main.Locate('SSel',True,[])=False then
|
|||
|
begin
|
|||
|
Application.MessageBox('û<><C3BB>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>','<27><>ʾ',0);
|
|||
|
exit;
|
|||
|
end;
|
|||
|
with CDS_Main do
|
|||
|
begin
|
|||
|
while Locate('SSel',True,[])=True do
|
|||
|
begin
|
|||
|
with ADOQueryPrint do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add('exec P_Print_Lable :MJID');
|
|||
|
Parameters.ParamByName('MJID').Value:=Trim(CDS_Main.fieldbyname('MJID').AsString);
|
|||
|
Open;
|
|||
|
end;
|
|||
|
fPrintFile:=ExtractFilePath(Application.ExeName)+'Report\ƥ<><C6A5><EFBFBD><EFBFBD>ǩ.rmf' ;
|
|||
|
if FileExists(fPrintFile) then
|
|||
|
begin
|
|||
|
RM1.LoadFromFile(fPrintFile);
|
|||
|
//RM1.ShowReport;
|
|||
|
RM1.PrintReport;
|
|||
|
end else
|
|||
|
begin
|
|||
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>'+ExtractFilePath(Application.ExeName)+'Report\ƥ<><C6A5><EFBFBD><EFBFBD>ǩ'),'<27><>ʾ',0);
|
|||
|
end;
|
|||
|
CDS_Main.Edit;
|
|||
|
CDS_Main.FieldByName('SSel').Value:=False;
|
|||
|
CDS_Main.Post;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end;
|
|||
|
procedure TfrmPRTJYList.GetCDSData();
|
|||
|
begin
|
|||
|
CDS_CD.FieldByName('MJXH').Value:=CDS_LS.fieldbyname('MJXH').Value;
|
|||
|
CDS_CD.FieldByName('SelfGangNo').Value:=CDS_LS.fieldbyname('SelfGangNo').Value;
|
|||
|
CDS_CD.FieldByName('PRTColor').Value:=CDS_LS.fieldbyname('PRTColor').Value;
|
|||
|
CDS_CD.FieldByName('PRTColorNo').Value:=CDS_LS.fieldbyname('PRTColorNo').Value;
|
|||
|
CDS_CD.FieldByName('MJLen').Value:=CDS_LS.fieldbyname('MJLen').Value;
|
|||
|
CDS_CD.FieldByName('MJLenMa').Value:=CDS_LS.fieldbyname('MJLenMa').Value;
|
|||
|
CDS_CD.FieldByName('MJJZ').Value:=CDS_LS.fieldbyname('MJQty4').Value;
|
|||
|
CDS_CD.FieldByName('MJMZ').Value:=CDS_LS.fieldbyname('MJMaoZ').Value;
|
|||
|
CDS_CD.FieldByName('MJFK').Value:=CDS_LS.fieldbyname('MJFK').Value;
|
|||
|
CDS_CD.FieldByName('KouFenHZ').Value:=CDS_LS.fieldbyname('KouFenHZ').Value;
|
|||
|
CDS_CD.FieldByName('KouFenAvg').Value:=CDS_LS.fieldbyname('KouFenAvg').Value;
|
|||
|
CDS_CD.FieldByName('MJID').Value:=CDS_LS.fieldbyname('MJID').Value;
|
|||
|
CDS_CD.FieldByName('FillTime').Value:=CDS_LS.fieldbyname('FillTime').Value;
|
|||
|
end;
|
|||
|
procedure TfrmPRTJYList.GetBGData();
|
|||
|
var
|
|||
|
FMJId:string;
|
|||
|
i,j,z:Integer;
|
|||
|
begin
|
|||
|
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
sql.Clear;
|
|||
|
sql.Add('select MJXH=Cast(0 as int),SelfGangNo=Cast('''' as varchar(20)),PRTColorNo=Cast('''' as varchar(20))');
|
|||
|
sql.Add(',MJID=Cast('''' as varchar(20)),PRTColor=Cast('''' as varchar(20)),FillTime=Cast(Null as datetime)');
|
|||
|
sql.Add(',MJLen=Cast(0 as decimal(18,1)),MJLenMa=Cast(0 as decimal(18,1)),MJJZ=Cast(0 as decimal(18,2)),XH=Cast(0 as int)');
|
|||
|
sql.Add(',MJMZ=Cast(0 as decimal(18,2)),MJFK=Cast(0 as decimal(18,2)),KouFenHZ=Cast(0 as int),KouFenAvg=Cast(0 as decimal(18,2))');
|
|||
|
sql.Add(',CDName0=Cast('''' as varchar(20)),CDBeg0=Cast('''' as varchar(20)),KFQty0=Cast(0 as int)');
|
|||
|
sql.Add(',CDName1=Cast('''' as varchar(20)),CDBeg1=Cast('''' as varchar(20)),KFQty1=Cast(0 as int)');
|
|||
|
sql.Add(',CDName2=Cast('''' as varchar(20)),CDBeg2=Cast('''' as varchar(20)),KFQty2=Cast(0 as int)');
|
|||
|
sql.Add(',CDName3=Cast('''' as varchar(20)),CDBeg3=Cast('''' as varchar(20)),KFQty3=Cast(0 as int)');
|
|||
|
sql.Add(',CDName4=Cast('''' as varchar(20)),CDBeg4=Cast('''' as varchar(20)),KFQty4=Cast(0 as int)');
|
|||
|
sql.Add(',CDName5=Cast('''' as varchar(20)),CDBeg5=Cast('''' as varchar(20)),KFQty5=Cast(0 as int)');
|
|||
|
sql.Add(',CDName6=Cast('''' as varchar(20)),CDBeg6=Cast('''' as varchar(20)),KFQty6=Cast(0 as int)');
|
|||
|
sql.Add(',CDName7=Cast('''' as varchar(20)),CDBeg7=Cast('''' as varchar(20)),KFQty7=Cast(0 as int)');
|
|||
|
sql.Add(',CDName8=Cast('''' as varchar(20)),CDBeg8=Cast('''' as varchar(20)),KFQty8=Cast(0 as int)');
|
|||
|
sql.Add(',CDName9=Cast('''' as varchar(20)),CDBeg9=Cast('''' as varchar(20)),KFQty9=Cast(0 as int)');
|
|||
|
sql.Add(',CDName10=Cast('''' as varchar(20)),CDBeg10=Cast('''' as varchar(20)),KFQty10=Cast(0 as int)');
|
|||
|
sql.Add(',CDName11=Cast('''' as varchar(20)),CDBeg11=Cast('''' as varchar(20)),KFQty11=Cast(0 as int)');
|
|||
|
sql.Add(',CDName12=Cast('''' as varchar(20)),CDBeg12=Cast('''' as varchar(20)),KFQty12=Cast(0 as int)');
|
|||
|
sql.Add(',CDName13=Cast('''' as varchar(20)),CDBeg13=Cast('''' as varchar(20)),KFQty13=Cast(0 as int)');
|
|||
|
sql.Add(',CDName14=Cast('''' as varchar(20)),CDBeg14=Cast('''' as varchar(20)),KFQty14=Cast(0 as int)');
|
|||
|
sql.Add(',CDName15=Cast('''' as varchar(20)),CDBeg15=Cast('''' as varchar(20)),KFQty15=Cast(0 as int)');
|
|||
|
sql.Add(',CDName16=Cast('''' as varchar(20)),CDBeg16=Cast('''' as varchar(20)),KFQty16=Cast(0 as int)');
|
|||
|
sql.Add(',CDName17=Cast('''' as varchar(20)),CDBeg17=Cast('''' as varchar(20)),KFQty17=Cast(0 as int)');
|
|||
|
sql.Add(',CDName18=Cast('''' as varchar(20)),CDBeg18=Cast('''' as varchar(20)),KFQty18=Cast(0 as int)');
|
|||
|
sql.Add(',CDName19=Cast('''' as varchar(20)),CDBeg19=Cast('''' as varchar(20)),KFQty19=Cast(0 as int)');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryTemp,CDS_CD);
|
|||
|
SInitCDSData20(ADOQueryTemp,CDS_CD);
|
|||
|
if CDS_CD.IsEmpty=False then CDS_CD.Delete;
|
|||
|
with ADOQueryTemp do
|
|||
|
begin
|
|||
|
Close;
|
|||
|
SQL.Clear;
|
|||
|
sql.Add('select AA.*, ');
|
|||
|
SQL.Add(' case when CDBeg=CDEnd then Cast(CDBeg as varchar(20)) else Cast(CDBeg as varchar(20))+''-''+Cast(CDEnd as varchar(20)) end as CDQK');
|
|||
|
sql.Add('from (select A.CDBeg,A.CDEnd,A.CDName,A.KouFen,B.MJXH,C.SelfGangNo,JS.PRTColorNo,JS.PRTColor,B.MJID, ');
|
|||
|
sql.Add(' Case when B.MJLen>0 then B.KouFenHZ*1.00*100/(B.MJLen*B.MJFK) else Null end as KouFenAvg');
|
|||
|
sql.Add(',CDEName=(select Note from KH_Zdy KZ where KZ.ZdyName=A.CDName and KZ.Type=''WFBCD'' )');
|
|||
|
sql.Add(',B.MJLen,B.MJLenMa,B.MJQty4,B.MJMaoZ,B.MJSJKZ,B.MJFK,B.MJType,B.KouFenHZ,B.FillTime');
|
|||
|
sql.Add(' from WFB_MJJY B ');
|
|||
|
sql.Add(' left join WFB_MJJY_CD A on B.MJID=A.MJID');
|
|||
|
sql.Add(' inner join JYOrder_Main_MD C on B.APID=C.MDID');
|
|||
|
sql.Add(' inner join JYOrder_Sub JS on C.ORDSubId=JS.SubId');
|
|||
|
SQL.Add(' where B.MainId='''+Trim(CDS_Main.fieldbyname('MainId').AsString)+'''');
|
|||
|
if Trim(MJType.Text)<>'' then
|
|||
|
begin
|
|||
|
sql.Add(' and isnull(B.MJType,'''')='''+Trim(MJType.Text)+'''');
|
|||
|
end;
|
|||
|
|
|||
|
sql.Add(')AA order by PRTColorNo,Cast(SelfGangNo as int),MJXH');
|
|||
|
Open;
|
|||
|
end;
|
|||
|
SCreateCDS20(ADOQueryTemp,CDS_LS);
|
|||
|
SInitCDSData20(ADOQueryTemp,CDS_LS);
|
|||
|
CDS_LS.DisableControls;
|
|||
|
with CDS_LS do
|
|||
|
begin
|
|||
|
First;
|
|||
|
while not Eof do
|
|||
|
begin
|
|||
|
if CDS_CD.IsEmpty then
|
|||
|
begin
|
|||
|
with CDS_CD do
|
|||
|
begin
|
|||
|
Append;
|
|||
|
GetCDSData();
|
|||
|
{if CheckBox1.Checked=True then
|
|||
|
FieldByName('CDName0').Value:=CDS_LS.fieldbyname('CDEName').Value
|
|||
|
else }
|
|||
|
FieldByName('CDName0').Value:=CDS_LS.fieldbyname('CDName').Value;
|
|||
|
FieldByName('CDBeg0').Value:=CDS_LS.fieldbyname('CDQK').Value;
|
|||
|
FieldByName('KFQty0').Value:=CDS_LS.fieldbyname('KouFen').Value;
|
|||
|
FieldByName('XH').Value:=CDS_LS.fieldbyname('MJXH').Value;
|
|||
|
Post;
|
|||
|
FMJId:=Trim(CDS_LS.fieldbyname('MJID').AsString);
|
|||
|
i:=0;//<2F>к<EFBFBD>
|
|||
|
j:=0;
|
|||
|
z:=0;//<2F>к<EFBFBD>
|
|||
|
end;
|
|||
|
end else
|
|||
|
begin
|
|||
|
if Trim(CDS_LS.fieldbyname('MJID').AsString)=FMJId then
|
|||
|
begin
|
|||
|
i:=i+1;
|
|||
|
if i<20 then
|
|||
|
begin
|
|||
|
with CDS_CD do
|
|||
|
begin
|
|||
|
Edit;
|
|||
|
GetCDSData();
|
|||
|
{if CheckBox1.Checked=True then
|
|||
|
FieldByName('CDName'+Trim(IntToStr(i))).Value:=CDS_LS.fieldbyname('CDEName').Value
|
|||
|
else }
|
|||
|
FieldByName('CDName'+Trim(IntToStr(i))).Value:=CDS_LS.fieldbyname('CDName').Value;
|
|||
|
FieldByName('CDBeg'+Trim(IntToStr(i))).Value:=CDS_LS.fieldbyname('CDQK').Value;
|
|||
|
FieldByName('KFQty'+Trim(IntToStr(i))).Value:=CDS_LS.fieldbyname('KouFen').Value;
|
|||
|
FieldByName('XH').Value:=CDS_LS.fieldbyname('MJXH').Value;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
end else
|
|||
|
begin
|
|||
|
i:=0;
|
|||
|
with CDS_CD do
|
|||
|
begin
|
|||
|
Append;
|
|||
|
GetCDSData();
|
|||
|
{if CheckBox1.Checked=True then
|
|||
|
FieldByName('CDName'+Trim(IntToStr(i))).Value:=CDS_LS.fieldbyname('CDEName').Value
|
|||
|
else}
|
|||
|
FieldByName('CDName'+Trim(IntToStr(i))).Value:=CDS_LS.fieldbyname('CDName').Value;
|
|||
|
FieldByName('CDBeg'+Trim(IntToStr(i))).Value:=CDS_LS.fieldbyname('CDQK').Value;
|
|||
|
FieldByName('KFQty'+Trim(IntToStr(i))).Value:=CDS_LS.fieldbyname('KouFen').Value;
|
|||
|
FieldByName('XH').Value:=CDS_LS.fieldbyname('MJXH').Value;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
end;
|
|||
|
end else
|
|||
|
begin
|
|||
|
i:=0;
|
|||
|
with CDS_CD do
|
|||
|
begin
|
|||
|
Append;
|
|||
|
GetCDSData();
|
|||
|
{if CheckBox1.Checked=True then
|
|||
|
FieldByName('CDName'+Trim(IntToStr(i))).Value:=CDS_LS.fieldbyname('CDEName').Value
|
|||
|
else}
|
|||
|
FieldByName('CDName'+Trim(IntToStr(i))).Value:=CDS_LS.fieldbyname('CDName').Value;
|
|||
|
FieldByName('CDBeg'+Trim(IntToStr(i))).Value:=CDS_LS.fieldbyname('CDQK').Value;
|
|||
|
FieldByName('KFQty'+Trim(IntToStr(i))).Value:=CDS_LS.fieldbyname('KouFen').Value;
|
|||
|
FieldByName('XH').Value:=CDS_LS.fieldbyname('MJXH').Value;
|
|||
|
Post;
|
|||
|
end;
|
|||
|
FMJId:=Trim(CDS_LS.fieldbyname('MJID').AsString);
|
|||
|
end;
|
|||
|
end;
|
|||
|
Next;
|
|||
|
end;
|
|||
|
end;
|
|||
|
CDS_LS.EnableControls;
|
|||
|
end;
|
|||
|
procedure TfrmPRTJYList.ToolButton4Click(Sender: TObject);
|
|||
|
var
|
|||
|
fPrintFile:string;
|
|||
|
begin
|
|||
|
if CDS_Main.IsEmpty then exit;
|
|||
|
GetBGData();
|
|||
|
fPrintFile:= ExtractFilePath(Application.ExeName) + 'Report\<5C><><EFBFBD>鱨<EFBFBD><E9B1A8>.rmf' ;
|
|||
|
if FileExists(fPrintFile) then
|
|||
|
begin
|
|||
|
RMCD.LoadFromFile(fPrintFile);
|
|||
|
RMVariables['OrderNo']:=Trim(CDS_Main.fieldbyname('OrderNo').AsString);
|
|||
|
RMVariables['CustomerNoName']:=Trim(CDS_Main.fieldbyname('CustomerNoName').AsString);
|
|||
|
//RMVariables['FillTIme']:=Trim(CDS_Main.fieldbyname('FillTIme').AsString);
|
|||
|
RMVariables['MPRTMF']:=Trim(CDS_Main.fieldbyname('MPRTMF').AsString);
|
|||
|
RMVariables['MPRTKZ']:=Trim(CDS_Main.fieldbyname('MPRTKZ').AsString);
|
|||
|
RMVariables['MPRTCode']:=Trim(CDS_Main.fieldbyname('MPRTCode').AsString);
|
|||
|
RMCD.ShowReport;
|
|||
|
end else
|
|||
|
begin
|
|||
|
Application.MessageBox(PChar('û<><C3BB><EFBFBD><EFBFBD>'+ExtractFilePath(Application.ExeName)+'Report\<5C><><EFBFBD>鱨<EFBFBD><E9B1A8>.rmf'),'<27><>ʾ',0);
|
|||
|
end;
|
|||
|
end;
|
|||
|
|
|||
|
end.
|