D7wmguihua/坯布码单待检(PBMDDJ.dll)/U_PRTJYListNew.pas
DESKTOP-E401PHE\Administrator b4b5840f18 1
2025-01-18 16:22:10 +08:00

2231 lines
112 KiB
ObjectPascal
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

unit U_PRTJYListNew;
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;
type
TfrmPRTJYListNew = 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;
TBRKCX: TToolButton;
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;
ToolButton2: TToolButton;
Lot: TComboBox;
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;
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 TBRKCXClick(Sender: TObject);
procedure ToolButton1Click(Sender: TObject);
procedure BtnEditA1BtnClick(Sender: TObject);
procedure ToolButton2Click(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);
private
FLeft,FTop:Integer;
procedure InitGrid();
procedure GetLotData();
procedure GetLotDataLie();
procedure GetLotDataLie38();
procedure GetLotDataLie38Ye();
{ Private declarations }
public
{ Public declarations }
end;
var
frmPRTJYListNew: TfrmPRTJYListNew;
implementation
uses
U_DataLink,U_RTFun,U_ZDYHelp,U_MJEdit;
{$R *.dfm}
procedure TfrmPRTJYListNew.FormDestroy(Sender: TObject);
begin
frmPRTJYListNew:=nil;
end;
procedure TfrmPRTJYListNew.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
Action:=caFree;
end;
procedure TfrmPRTJYListNew.FormCreate(Sender: TObject);
begin
//cxGrid1.Align:=alClient;
BegDate.DateTime:=SGetServerDateTime(ADOQueryTemp);
EndDate.DateTime:=SGetServerDateTime(ADOQueryTemp)
end;
procedure TfrmPRTJYListNew.InitGrid();
begin
try
ADOQueryMain.DisableControls;
with ADOQueryMain do
begin
Filtered:=False;
Close;
sql.Clear;
SQL.Add('select D.*,');
SQL.Add(' B.OrderNo,MPRTCode=B.MPRTCode+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 ,'); //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>=:begdate and D.FillTime<:enddate');
Parameters.ParamByName('begdate').Value:=Trim(FormatDateTime('yyyy-MM-dd',BegDate.DateTime));
Parameters.ParamByName('enddate').Value:=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 TfrmPRTJYListNew.TBRafreshClick(Sender: TObject);
begin
BegDate.SetFocus;
InitGrid();
end;
procedure TfrmPRTJYListNew.ConNoMChange(Sender: TObject);
begin
if ADOQueryMain.Active then
begin
SDofilter(ADOQueryMain,SGetFilters(Panel1,1,2));
end;
end;
procedure TfrmPRTJYListNew.TBCloseClick(Sender: TObject);
begin
WriteCxGrid('<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>CX',Tv1,'<27><>Ʒ<EFBFBD><C6B7><EFBFBD><EFBFBD>');
Close;
end;
procedure TfrmPRTJYListNew.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 TfrmPRTJYListNew.TBExportClick(Sender: TObject);
begin
if ADOQueryMain.IsEmpty then exit;
TcxGridToExcel('<27><><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD>',cxGrid2);
end;
procedure TfrmPRTJYListNew.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 TfrmPRTJYListNew.MPRTCodeNameChange(Sender: TObject);
begin
TBFind.Click;
end;
procedure TfrmPRTJYListNew.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 TfrmPRTJYListNew.orderNoChange(Sender: TObject);
begin
if Length(Trim(orderNo.Text))<4 then Exit;
TBFind.Click;
end;
procedure TfrmPRTJYListNew.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.*,');
SQL.Add(' B.OrderNo,MPRTCode=B.MPRTCode+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,'); //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 :OrderNo');
//sql.Add(' and D.Valie=''Y'' ');
Parameters.ParamByName('orderNo').Value:='%'+Trim(orderNo.Text)+'%';
Open;
//ShowMessage(SQL.Text);
end;
SCreateCDS20(ADOQueryMain,CDS_Main);
SInitCDSData20(ADOQueryMain,CDS_Main);
finally
ADOQueryMain.EnableControls;
end;
end;
end;
procedure TfrmPRTJYListNew.N1Click(Sender: TObject);
begin
SelOKNo(CDS_Main,True);
end;
procedure TfrmPRTJYListNew.N2Click(Sender: TObject);
begin
SelOKNo(CDS_Main,False);
end;
procedure TfrmPRTJYListNew.TBRKCXClick(Sender: TObject);
begin
if CDS_Main.IsEmpty then Exit;
if Application.MessageBox(<><C8B7>Ҫִ<D2AA>в<EFBFBD><D0B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>','<27><>ʾ',32+4)<>IDYES then Exit;
BegDate.SetFocus;
try
ADOQueryCmd.Connection.BeginTrans;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.Add('delete WFB_MJJY where MJID='''+Trim(CDS_Main.fieldbyname('MJID').AsString)+'''');
ExecSQL;
end;
ADOQueryCmd.Connection.CommitTrans;
CDS_Main.Delete;
except
ADOQueryCmd.Connection.RollbackTrans;
Application.MessageBox('<27><><EFBFBD><EFBFBD>ʧ<EFBFBD><CAA7>!','<27><>ʾ',0);
end;
end;
procedure TfrmPRTJYListNew.GetLotData();
var
i,j,z,h,q,Hang,GHang,JuanQty,GangQty: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('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(' JJQty=(select Count(*) from WFB_MJJY WM where WM.SubId=JS.SubId),');
//sql.Add(' GGQty=(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 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');
//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),');
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
with ADOQueryTemp do
begin
Close;
sql.Clear;
SQL.Add('select Count(*) JuanQty from WFB_MJJY where SubId='''+Trim(CDS_Juan.fieldbyname('SubId').AsString)+'''');
Open;
end;
JuanQty:=ADOQueryTemp.fieldbyname('JuanQty').AsInteger;
with ADOQueryTemp do
begin
Close;
sql.Clear;
SQL.Add('select Count(*) GangQty from WFB_MJJY A');
sql.Add(' inner join JYOrder_Main_MD B on A.APID=B.MDID ');
sql.Add(' where A.SubId='''+Trim(CDS_Juan.fieldbyname('SubId').AsString)+'''');
sql.Add(' and B.SelfGangNo='''+Trim(CDS_Juan.fieldbyname('GangNo').AsString)+'''');
Open;
end;
GangQty:=ADOQueryTemp.fieldbyname('GangQty').AsInteger;
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:=JuanQty;
CDS_JuanPRT.FieldByName('GangQty').Value:=GangQty;
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;
with ADOQueryTemp do
begin
Close;
sql.Clear;
SQL.Add('select Count(*) JuanQty from WFB_MJJY where SubId='''+Trim(CDS_Juan.fieldbyname('SubId').AsString)+'''');
Open;
end;
JuanQty:=ADOQueryTemp.fieldbyname('JuanQty').AsInteger;
with ADOQueryTemp do
begin
Close;
sql.Clear;
SQL.Add('select Count(*) GangQty from WFB_MJJY A');
sql.Add(' inner join JYOrder_Main_MD B on A.APID=B.MDID ');
sql.Add(' where A.SubId='''+Trim(CDS_Juan.fieldbyname('SubId').AsString)+'''');
sql.Add(' and B.SelfGangNo='''+Trim(CDS_Juan.fieldbyname('GangNo').AsString)+'''');
Open;
end;
GangQty:=ADOQueryTemp.fieldbyname('GangQty').AsInteger;
end else
begin
Hang:=Hang+1;
with ADOQueryTemp do
begin
Close;
sql.Clear;
SQL.Add('select Count(*) GangQty from WFB_MJJY A');
sql.Add(' inner join JYOrder_Main_MD B on A.APID=B.MDID ');
sql.Add(' where A.SubId='''+Trim(CDS_Juan.fieldbyname('SubId').AsString)+'''');
sql.Add(' and B.SelfGangNo='''+Trim(CDS_Juan.fieldbyname('GangNo').AsString)+'''');
Open;
end;
GangQty:=ADOQueryTemp.fieldbyname('GangQty').AsInteger;
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:=JuanQty;
CDS_JuanPRT.FieldByName('GangQty').Value:=GangQty;
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:=JuanQty;
CDS_JuanPRT.FieldByName('GangQty').Value:=GangQty;
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 TfrmPRTJYListNew.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)+'''');
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(' 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 TfrmPRTJYListNew.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 TfrmPRTJYListNew.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');
//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 TfrmPRTJYListNew.ToolButton1Click(Sender: TObject);
var
fPrintFile:String;
begin
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
begin
GetLotData();
end;
with ADOQueryCmd do
begin
Close;
sql.Clear;
sql.add('select AAA.*,JSM.OrderNo,JSB.PRTColorEng,JSB.PRTHX,JSB.PRTColorNo 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 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)+'''');
sql.Add(' and ZhuangXiangSYFlag=0');
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 TfrmPRTJYListNew.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 TfrmPRTJYListNew.ToolButton2Click(Sender: TObject);
begin
try
frmMJEdit:=TfrmMJEdit.Create(Application);
with frmMJEdit do
begin
MJID.Text:=Trim(Self.CDS_Main.fieldbyname('MJID').AsString);
with ADOTmp do
begin
Close;
sql.Clear;
SQL.Add('select A.* from WFB_MJJY A ');
sql.Add(' where A.MJID='''+Trim(MJID.Text)+'''');
Open;
end;
if ADOTmp.IsEmpty then
begin
MJID.Text:='';
Label2.Caption:='';
Label2.Visible:=False;
Application.MessageBox('<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!','<27><>ʾ',0);
Exit;
end;
MJMaoZ.Text:=Trim(ADOTmp.fieldbyname('MJMaoZ').AsString);
MJLen.Text:=Trim(ADOTmp.fieldbyname('MJLen').AsString);
MJQty3.Text:=Trim(ADOTmp.fieldbyname('MJQty3').AsString);
MJQty2.Text:=Trim(ADOTmp.fieldbyname('MJQty2').AsString);
MJQty4.Text:=Trim(ADOTmp.fieldbyname('MJQty4').AsString);
MJFK.Text:=Trim(ADOTmp.fieldbyname('MJFK').AsString);
MJSJKZ.Text:=Trim(ADOTmp.fieldbyname('MJSJKZ').AsString);
//M.Caption:=Trim(Trim(ADOTmp.fieldbyname('MJTypeOther').AsString));
// Ma.Caption:=Trim(Trim(ADOTmp.fieldbyname('MJStr1').AsString));
if Trim(Trim(ADOTmp.fieldbyname('MJType').AsString))='<27><>Ʒ' then
begin
RadioGroup1.ItemIndex:=0
end else
if Trim(Trim(ADOTmp.fieldbyname('MJType').AsString))='<27><>Ʒ' then
begin
RadioGroup1.ItemIndex:=1;
end else
if Trim(Trim(ADOTmp.fieldbyname('MJType').AsString))='<27><>ƴ' then
begin
RadioGroup1.ItemIndex:=2;
end;
with ADOTmp do
begin
Close;
sql.Clear;
SQL.Add('select * from WFB_MJJY_CD A where A.MJID='''+Trim(MJID.Text)+'''');
Open;
end;
Label2.Caption:=Trim(MJID.Text);
Label2.Visible:=True;
MJID.Text:='';
SCreateCDS20(ADOTmp,Order_MJ);
SInitCDSData20(ADOTmp,Order_MJ);
if ShowModal=1 then
begin
end;
end;
finally
frmMJEdit.Free;
end;
end;
procedure TfrmPRTJYListNew.Panel10MouseMove(Sender: TObject;
Shift: TShiftState; X, Y: Integer);
begin
ReleaseCapture;
TWinControl(Panel4).Perform(WM_SYSCOMMAND,$F012,0);
end;
procedure TfrmPRTJYListNew.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 TfrmPRTJYListNew.Image2Click(Sender: TObject);
begin
Panel4.Visible:=False;
end;
procedure TfrmPRTJYListNew.Tv1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
FLeft:=X;
FTop:=Y;
end;
end.