赋值
AOrder.LoadSimpleFromFile(sDefineFile);
grdRowFileDefine_PostalCode.Properties.Value := AOrder.OrderCode;
grdRowFileDefine_CardKind.Properties.Value := TMonitor.GetCardKindCHS(AOrder.OrderKind);
grdRowFileDefine_SendUser.Properties.Value := AOrder.SendUser;
grdRowFileDefine_SendEmail.Properties.Value := AOrder.SendEmail;
grdRowFileDefine_SendPhone.Properties.Value := AOrder.SendPhone;
grdRowFileDefine_SendAddress.Properties.Value := AOrder.SendAddress;
procedure SetRowProperties(ARow: TcxEditorRow; AValue: Variant);
begin
AValue := VarToStrDef(AValue, '');
if AValue = '' then
AValue := null;
try
ARow.Properties.Value := AValue;
except
ARow.Properties.Value := null;
end;
{ if ARow.Properties.EditPropertiesClass = TcxDateEditProperties then
begin
dTime := StrToDateTimeDef(AValue, 0);
if dTime = 0 then ARow.Properties.Value := null
else ARow.Properties.Value := dTime;
end
else if VarToStrDef(AValue, '') = '' then
begin
if not ARow.Properties.DataBinding.ValueTypeClass.IsString then
AValue := 0;
end;
try
ARow.Properties.Value := AValue;
finally
end; }
end;
function GetRowProperties(ARow: TcxEditorRow): string;
begin
result := VarToStrDef(ARow.Properties.Value, '');
end;
mySql := 'select * from stCardPlate where iBillID=' + IntToStr(ABillID);
OpenQuery(qryUnit, mySql);
with qryUnit do
begin
if qryUnit.Eof then
begin
(* 默认制版信息 *)
SetRowProperties(vgPlateCRevColor, 'K,C,M,Y');
SetRowProperties(vgPlateCObvColor, 'K,C,M,Y');
SetRowProperties(vgPlateIProof, '1');
SetRowProperties(vgPlateIFilm, '1');
end
else begin
TPrinterpAngel.QueryToVerticalGrid(vgPlate, qryUnit, 'vgPlate');
SetRowProperties(vgPlateCObvColor, FieldByName('cObvColor').AsString);
SetRowProperties(vgPlateCRevColor, FieldByName('cRevColor').AsString);
SetRowProperties(vgPlateIProof, FieldByName('iProof').AsString);
SetRowProperties(vgPlateIFilm, FieldByName('iFilm').AsString);
SetRowProperties(vgPlateCWorkShop, FieldByName('cWorkShop').AsString);
end;
end;
(* 印刷信息 *)
mySql := 'select * from stCardPrint where iBillID=' + IntToStr(ABillID);
OpenQuery(qryUnit, mySql);
with qryUnit do
begin
if qryUnit.Eof then
begin
(* 默认印刷信息 *)
end
else begin
TPrinterpAngel.QueryToVerticalGrid(vgPrint, qryUnit, 'vgPrint');
end;
end;
(* 印刷机型 *)
mySql := 'select id, cbmmc from dzbm where cbmlb = ''生产'' order by id';
OpenQuery(qryUnit, mySql);
while not qryUnit.Eof do
begin
with TcxImageComboBoxProperties(vgPlateCWorkShop.Properties.EditProperties).Items.Add do
begin
Value := qryUnit.FieldByName('cbmmc').AsString;
Description := qryUnit.FieldByName('cbmmc').AsString;
end;
with TcxImageComboBoxProperties(vgPrintCWorkShop.Properties.EditProperties).Items.Add do
begin
Value := qryUnit.FieldByName('cbmmc').AsString;
Description := qryUnit.FieldByName('cbmmc').AsString;
end;
qryUnit.Next;
end;
function TfrmStampCardProduce.DataSave: boolean;
var
sqlList: TStringList;
begin
sqlList := TStringList.Create;
(* 制版 *)
sqlList.Add('if not Exists(select 1 from stcardplate where ibillid=' + IntToStr(FBillID) + ') ' +
' insert into stcardplate(ibillid, dplanComplete, iRevFilm, iObvFilm) ' +
' values(' + IntToStr(FBillID) + ', 0, 0, 0)');
sqlList.Add('Update stcardplate set ' +
' cRevColor=''' + GetRowProperties(vgPlateCRevColor) + '''' +
',cObvColor=''' + GetRowProperties(vgPlateCObvColor) + '''' +
',iProof=' + IntToStr(StrToIntPrint(GetRowProperties(vgPlateIProof))) +
',iFilm=' + IntToStr(StrToIntPrint(GetRowProperties(vgPlateIFilm))) +
',iRevFilm=' + IntToStr(StrToIntPrint(GetRowProperties(vgPlateIRevFilm))) +
',iObvFilm=' + IntToStr(StrToIntPrint(GetRowProperties(vgPlateIObvFilm))) +
',dPlanComplete=''' + FormatDateTime('yyyy-mm-dd', StrToIntPrint(GetRowProperties(vgPlateDPlanComplete))) + '''' +
',CWorkShop=''' + vgPlateCWorkShop.Properties.Value + '''' +
',cMemo=''' + GetRowProperties(vgPlateCMemo) + '''' +
' where ibillID=' + IntToStr(FBillid));
(* 印刷 *)
sqlList.Add('if not Exists(select 1 from stcardPrint where ibillid=' + IntToStr(FBillID) + ') ' +
' insert into stcardPrint(ibillid, dplanComplete, iPaperid, iMachineid)' +
' values(' + IntToStr(FBillID) + ', 0, 0, 0)');
sqlList.Add('Update stcardPrint set ' +
' cRevColor=''' + GetRowProperties(vgPrintCRevColor) + '''' +
',cObvColor=''' + GetRowProperties(vgPrintCObvColor) + '''' +
',cWorkShop=''' + GetRowProperties(vgPrintCWorkShop) + '''' +
',iPaperid=' + IntToStr(StrToIntPrint(GetRowProperties(vgPrintIPaperID))) +
',iPaperConsume=' + IntToStr(StrToIntPrint(GetRowProperties(vgPrintIPaperConsume))) +
',iPaperGross=' + IntToStr(StrToIntPrint(GetRowProperties(vgPrintIPaperGross))) +
',iDelivery=' + IntToStr(StrToIntPrint(GetRowProperties(vgPrintIDelivery))) +
',nEligible=' + IntToStr(StrToIntPrint(GetRowProperties(vgPrintNEligible))) +
',dPlanComplete=''' + FormatDateTime('yyyy-mm-dd', StrToIntPrint(GetRowProperties(vgPrintDPlanComplete))) + '''' +
',cMemo=''' + GetRowProperties(vgPrintCMemo) + '''' +
' where ibillID=' + IntToStr(FBillid));
try
TPrinterpAngel.ExecuteSQLs(sqlList);
finally
sqlList.Free;
end;
result := True;
end;