2025-01-21 15:36:19 +08:00
unit U_CPDBAO;
2026-02-05 17:27:52 +08:00
interface
2025-01-21 15:36:19 +08:00
uses
2026-02-05 17:27:52 +08:00
Windows, Messages, strutils, SysUtils, Variants, Classes, Graphics, Controls,
Forms, Dialogs, cxStyles, cxCustomData, cxGraphics, cxFilter, cxData,
2025-01-21 15:36:19 +08:00
cxDataStorage, cxEdit, DB, cxDBData, cxGridLevel, cxGridCustomTableView,
2026-02-05 17:27:52 +08:00
cxGridTableView, cxGridDBTableView, cxClasses, cxControls, cxGridCustomView,
cxGrid, StdCtrls, cxContainer, cxTextEdit, cxCurrencyEdit, BtnEdit, ExtCtrls,
ComCtrls, ToolWin, DBClient, ADODB, MovePanel, Buttons, Menus,
cxLookAndFeelPainters, cxButtons, RM_Common, RM_Class, RM_GridReport,
RM_System, RM_Dataset, cxCheckBox, MMSystem, cxLookAndFeels, cxNavigator,
dxSkinsCore, dxSkinBlack, dxSkinBlue, dxSkinBlueprint, dxSkinCaramel,
dxSkinCoffee, dxSkinDarkRoom, dxSkinDarkSide, dxSkinDevExpressDarkStyle,
dxSkinDevExpressStyle, dxSkinFoggy, dxSkinGlassOceans, dxSkinHighContrast,
dxSkiniMaginary, dxSkinLilian, dxSkinLiquidSky, dxSkinLondonLiquidSky,
dxSkinMcSkin, dxSkinMetropolis, dxSkinMetropolisDark, dxSkinMoneyTwins,
dxSkinOffice2007Black, dxSkinOffice2007Blue, dxSkinOffice2007Green,
dxSkinOffice2007Pink, dxSkinOffice2007Silver, dxSkinOffice2010Black,
dxSkinOffice2010Blue, dxSkinOffice2010Silver, dxSkinOffice2013DarkGray,
dxSkinOffice2013LightGray, dxSkinOffice2013White, dxSkinPumpkin, dxSkinSeven,
dxSkinSevenClassic, dxSkinSharp, dxSkinSharpPlus, dxSkinSilver,
dxSkinSpringTime, dxSkinStardust, dxSkinSummer2008, dxSkinTheAsphaltWorld,
dxSkinsDefaultPainters, dxSkinValentine, dxSkinVS2010, dxSkinWhiteprint,
dxSkinXmas2008Blue, dxSkinscxPCPainter;
2025-01-21 15:36:19 +08:00
type
TfrmCPDBao = class( TForm)
ToolBar1: TToolBar;
TBClose: TToolButton;
Panel1: TPanel;
PHYG: TBtnEditA;
defstr2: TComboBox;
Label16: TLabel;
Label15: TLabel;
packNo: TcxCurrencyEdit;
Label14: TLabel;
Label1: TLabel;
Panel2: TPanel;
cxGrid2: TcxGrid;
TV2: TcxGridDBTableView;
cxGridDBColumn1: TcxGridDBColumn;
cxGridDBColumn2: TcxGridDBColumn;
cxGridDBColumn3: TcxGridDBColumn;
cxGridDBColumn4: TcxGridDBColumn;
cxGridDBColumn5: TcxGridDBColumn;
cxGridDBColumn6: TcxGridDBColumn;
cxGridDBColumn7: TcxGridDBColumn;
cxGridLevel1: TcxGridLevel;
ADOQueryMain: TADOQuery;
ADOQueryCmd: TADOQuery;
CDSMJID: TClientDataSet;
DataSource2: TDataSource;
SmNO: TEdit;
ADOQueryTmp: TADOQuery;
V2Column1: TcxGridDBColumn;
kcKw: TBtnEditA;
Label5: TLabel;
MovePanel1: TMovePanel;
Edit2: TEdit;
Button4: TButton;
Label2: TLabel;
cxStyleRepository1: TcxStyleRepository;
cxStyle1: TcxStyle;
cxStyle2: TcxStyle;
cxStyle_gridRow: TcxStyle;
cxStyle_gridFoot: TcxStyle;
cxStyle_gridHead: TcxStyle;
cxStyle_gridGroupBox: TcxStyle;
cxStyle_yellow: TcxStyle;
cxStyle_Red: TcxStyle;
cxStyle_fontBlack: TcxStyle;
cxStyle_fontclFuchsia: TcxStyle;
cxStyle_fontclPurple: TcxStyle;
cxStyle_fontclGreen: TcxStyle;
cxStyle_fontclBlue: TcxStyle;
cxStyle_fontclTeal: TcxStyle;
cxStyle_fontclOlive: TcxStyle;
ADOQuery1: TADOQuery;
DataSource1: TDataSource;
cxGrid3: TcxGrid;
Tv3: TcxGridDBTableView;
cxGridLevel2: TcxGridLevel;
Tv3Column1: TcxGridDBColumn;
ADOQueryTm: TADOQuery;
DSTm: TDataSource;
baoNo: TEdit;
BaoID: TEdit;
Label3: TLabel;
Label4: TLabel;
V2BaoNO: TcxGridDBColumn;
V2BaoID: TcxGridDBColumn;
Panel3: TPanel;
SpeedButton1: TSpeedButton;
SpeedButton2: TSpeedButton;
SpeedButton3: TSpeedButton;
SpeedButton4: TSpeedButton;
SpeedButton5: TSpeedButton;
SpeedButton6: TSpeedButton;
SpeedButton7: TSpeedButton;
SpeedButton8: TSpeedButton;
SpeedButton9: TSpeedButton;
SpeedButton10: TSpeedButton;
SpeedButton11: TSpeedButton;
SpeedButton12: TSpeedButton;
SpeedButton49: TSpeedButton;
FileName: TcxButton;
RMDB_Main: TRMDBDataSet;
RM2: TRMGridReport;
cxButton1: TcxButton;
ComboBox1: TComboBox;
V2Column2: TcxGridDBColumn;
V2Column3: TcxGridDBColumn;
Panel4: TPanel;
ADOQueryPrint: TADOQuery;
Label6: TLabel;
BtnEditA1: TBtnEditA;
v3Column1: TcxGridDBColumn;
v3Column2: TcxGridDBColumn;
v3Column3: TcxGridDBColumn;
CDSTM: TClientDataSet;
Panel5: TPanel;
cxButton3: TcxButton;
cxButton2: TcxButton;
CDSSEL: TClientDataSet;
cxGrid1: TcxGrid;
TV4: TcxGridDBTableView;
cxGridDBColumn8: TcxGridDBColumn;
cxGridDBColumn9: TcxGridDBColumn;
cxGridDBColumn10: TcxGridDBColumn;
cxGridDBColumn11: TcxGridDBColumn;
cxGridDBColumn12: TcxGridDBColumn;
cxGridDBColumn13: TcxGridDBColumn;
cxGridDBColumn14: TcxGridDBColumn;
cxGridDBColumn15: TcxGridDBColumn;
cxGridDBColumn16: TcxGridDBColumn;
cxGridDBColumn17: TcxGridDBColumn;
cxGridDBColumn18: TcxGridDBColumn;
cxGridDBColumn19: TcxGridDBColumn;
cxGridLevel3: TcxGridLevel;
DSSEL: TDataSource;
cxButton4: TcxButton;
V2Column5: TcxGridDBColumn;
V2Column4: TcxGridDBColumn;
V4Column1: TcxGridDBColumn;
V4Column2: TcxGridDBColumn;
v3Column4: TcxGridDBColumn;
check_Fbz: TCheckBox;
Fbq: TBtnEditA;
ComboBox2: TComboBox;
check_bz: TCheckBox;
BaoBq: TBtnEditA;
cxButton5: TcxButton;
cxButton6: TcxButton;
v3Column5: TcxGridDBColumn;
CheckBox1: TCheckBox;
ComboBox3: TComboBox;
v3Column6: TcxGridDBColumn;
v3Column7: TcxGridDBColumn;
cxButton7: TcxButton;
v3Column8: TcxGridDBColumn;
Label7: TLabel;
PRTColor: TEdit;
SOrddefstr1: TEdit;
Label8: TLabel;
PRTHX: TEdit;
Label9: TLabel;
mjstr4: TEdit;
Label10: TLabel;
MJXH: TEdit;
Label11: TLabel;
ComboBox4: TComboBox;
Label12: TLabel;
ADOQuery2: TADOQuery;
2026-02-05 17:27:52 +08:00
PopupMenu1: TPopupMenu;
N1: TMenuItem;
N2: TMenuItem;
cxButton8: TcxButton;
2025-01-21 15:36:19 +08:00
procedure FormDestroy( Sender: TObject) ;
procedure FormClose( Sender: TObject; var Action: TCloseAction) ;
procedure TBCloseClick( Sender: TObject) ;
procedure FormCreate( Sender: TObject) ;
procedure SmNOKeyPress( Sender: TObject; var Key: Char ) ;
procedure FormShow( Sender: TObject) ;
2026-02-05 17:27:52 +08:00
procedure TV2CustomDrawCell( Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean ) ;
2025-01-21 15:36:19 +08:00
procedure kcKwBtnClick( Sender: TObject) ;
procedure Button4Click( Sender: TObject) ;
procedure baoNoKeyPress( Sender: TObject; var Key: Char ) ;
procedure baoNoClick( Sender: TObject) ;
procedure SpeedButton1Click( Sender: TObject) ;
procedure SpeedButton12Click( Sender: TObject) ;
procedure SpeedButton49Click( Sender: TObject) ;
procedure FileNameClick( Sender: TObject) ;
procedure cxButton1Click( Sender: TObject) ;
procedure baoNoExit( Sender: TObject) ;
procedure BtnEditA1BtnClick( Sender: TObject) ;
procedure cxButton3Click( Sender: TObject) ;
procedure cxButton2Click( Sender: TObject) ;
procedure cxButton4Click( Sender: TObject) ;
procedure FbqBtnClick( Sender: TObject) ;
procedure BaoBqBtnClick( Sender: TObject) ;
procedure cxButton5Click( Sender: TObject) ;
procedure cxButton6Click( Sender: TObject) ;
procedure cxButton7Click( Sender: TObject) ;
2026-02-05 17:27:52 +08:00
procedure N1Click( Sender: TObject) ;
procedure N2Click( Sender: TObject) ;
procedure cxButton8Click( Sender: TObject) ;
2025-01-21 15:36:19 +08:00
private
2026-02-05 17:27:52 +08:00
Rolls: integer ;
2025-01-21 15:36:19 +08:00
procedure InitGrid( ) ;
procedure InitMJID( ) ;
2026-02-05 17:27:52 +08:00
function SaveRK( ) : Boolean ;
procedure QueryRk( ) ;
procedure QueryTM( ) ;
2025-01-21 15:36:19 +08:00
{ Private declarations }
public
{ Public declarations }
end ;
2026-02-05 17:27:52 +08:00
2025-01-21 15:36:19 +08:00
var
frmCPDBao: TfrmCPDBao;
2026-02-05 17:27:52 +08:00
newh: hwnd;
2025-01-21 15:36:19 +08:00
implementation
2026-02-05 17:27:52 +08:00
2025-01-21 15:36:19 +08:00
uses
2026-02-05 17:27:52 +08:00
U_DataLink, U_Fun, U_ZDYHelp, U_OrderSelRK;
2025-01-21 15:36:19 +08:00
{$R *.dfm}
2026-02-05 17:27:52 +08:00
procedure TfrmCPDBao. QueryTm( ) ;
2025-01-21 15:36:19 +08:00
var
2026-02-05 17:27:52 +08:00
FBaoID: string ;
2025-01-21 15:36:19 +08:00
begin
2026-02-05 17:27:52 +08:00
2025-01-21 15:36:19 +08:00
with ADOQueryTM do
begin
close;
sql. Clear;
sql. Add( 'select A.*,B.*,C.MPrtCodeName,C.orderNo as OrderNoM' ) ;
sql. Add( 'from WFB_MJJY A ' ) ;
sql. Add( 'inner join JYOrder_sub B on B.subID=A.subID ' ) ;
sql. Add( 'inner join JYOrder_main C on C.mainID=A.MainID ' ) ;
2026-02-05 17:27:52 +08:00
sql. Add( 'and isnull(A.BAOID,' '' ')=' '' ' and A.mjstr2=' 'δ<> <CEB4> <EFBFBD> <EFBFBD> ' ' and C.orderNo=' + quotedstr( trim( BtnEditA1. Text ) ) ) ;
2025-01-21 15:36:19 +08:00
open;
end ;
2026-02-05 17:27:52 +08:00
SCreateCDS20( ADOQueryTM, CDSTM) ;
SInitCDSData20( ADOQueryTM, CDSTM) ;
//if CDSMJID.IsEmpty then
// exit;
// if CDSMJID.fieldByName('SDefNote').AsString <> '' then
// begin
// application.MessageBox('<27> Ѵ <EFBFBD> <D1B4> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ɾ<EFBFBD> <C9BE> <EFBFBD> <EFBFBD> ', '<27> <> ʾ <EFBFBD> <CABE> Ϣ', 0);
// exit;
// end
if not CDSMJID. IsEmpty then
begin
Rolls : = 0 ;
with CDSMJID do
begin
DisableControls;
first;
while not eof do
begin
Rolls : = Rolls + 1 ;
next;
end ;
EnableControls;
end ;
end
else
SCreateCDS20( ADOQueryTM, CDSMJID) ;
// SInitCDSData20(ADOQueryMain, CDSMJID);
2025-01-21 15:36:19 +08:00
2026-02-05 17:27:52 +08:00
with ADOQueryMain do
begin
close;
sql. Clear;
sql. Add( 'select A.*,B.* ,MPrtCodeName,C.orderNo as OrderNoM' ) ;
sql. Add( 'from WFB_MJJY A ' ) ;
sql. Add( 'inner join JYOrder_sub B on B.subID=A.subID ' ) ;
sql. Add( 'inner join JYOrder_main C on C.mainID=A.MainID ' ) ;
sql. Add( 'and isnull(A.BAOID,' '' ')<>' '' ' and A.mjstr2=' 'δ<> <CEB4> <EFBFBD> <EFBFBD> ' ' and C.orderNo=' + quotedstr( trim( BtnEditA1. Text ) ) ) ;
SQL. Add( 'order by [dbo].[Get_ShuZi](BaoNo)' ) ;
open;
end ;
SCreateCDS20( ADOQueryMain, CDSSEL) ;
SInitCDSData20( ADOQueryMain, CDSSEL) ;
2025-01-21 15:36:19 +08:00
2026-02-05 17:27:52 +08:00
if not CDSTM. IsEmpty then
2025-01-21 15:36:19 +08:00
begin
with ADOQuery1 do
begin
close;
sql. clear;
sql. add( 'select isnull(max(cast(baoNo as int)),0)+1 as MaxBaoNo from WFB_MJJY ' ) ;
2026-02-05 17:27:52 +08:00
sql. Add( 'where mainID=' + quotedstr( trim( CDSTM. fieldbyname( 'MainID' ) . AsString) ) ) ;
2025-01-21 15:36:19 +08:00
open;
end ;
2026-02-05 17:27:52 +08:00
// baoNo.text := ADOQuery1.fieldbyname('MaxBaoNo').AsString;
if GetLSNo( ADOQueryTmp, FBaoID, 'BI' , 'WFB_MJJY' , 4 , 1 ) = False then
2025-01-21 15:36:19 +08:00
begin
ADOQueryCmd. Connection. RollbackTrans;
2026-02-05 17:27:52 +08:00
Application. MessageBox( 'ȡ<> <C8A1> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ʧ<EFBFBD> ܣ<EFBFBD> ' , '<27> <> ʾ ' , 0 ) ;
2025-01-21 15:36:19 +08:00
Exit;
end ;
2026-02-05 17:27:52 +08:00
BaoID. Text : = trim( FBaoID) ;
2025-01-21 15:36:19 +08:00
end ;
SMNO. SetFocus;
2026-02-05 17:27:52 +08:00
// with ADOQueryTM do
// begin
// close;
// sql.Clear;
// sql.Add('select A.*,B.*,C.MPrtCodeName,C.orderNo as OrderNoM');
// sql.Add('from WFB_MJJY A ');
// sql.Add('inner join JYOrder_sub B on B.subID=A.subID ');
// sql.Add('inner join JYOrder_main C on C.mainID=A.MainID ');
// sql.Add('and A.mjstr2=''δ<> <CEB4> <EFBFBD> <EFBFBD> '' and C.orderNo=' + quotedstr(trim(BtnEditA1.Text)));
// open;
// end;
// SCreateCDS20(ADOQueryTM, CDSTM);
// SInitCDSData20(ADOQueryTM, CDSTM);
//
// SCreateCDS20(ADOQueryTM, CDSMJID);
//// SInitCDSData20(ADOQueryMain,CDSMJID);
// SCreateCDS20(ADOQueryTM, CDSSEL);
//// SInitCDSData20(ADOQueryMain,CDSSEL);
//
// if not CDSTM.IsEmpty then
// begin
// with ADOQuery1 do
// begin
// close;
// sql.clear;
// sql.add('select isnull(max(cast(baoNo as int)),0)+1 as MaxBaoNo from WFB_MJJY ');
// sql.Add('where mainID=' + quotedstr(trim(CDSTM.fieldbyname('MainID').AsString)));
// open;
// end;
// baoNo.text := ADOQuery1.fieldbyname('MaxBaoNo').AsString;
// if GetLSNo(ADOQueryTmp, FBaoID, 'BI', 'WFB_MJJY', 4, 1) = False then
// begin
// ADOQueryCmd.Connection.RollbackTrans;
// Application.MessageBox('ȡ<> <C8A1> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ʧ<EFBFBD> ܣ<EFBFBD> ', '<27> <> ʾ ', 0);
// Exit;
// end;
// BaoID.Text := trim(FBaoID);
// end;
//
// SMNO.SetFocus;
2025-01-21 15:36:19 +08:00
end ;
2026-02-05 17:27:52 +08:00
procedure TfrmCPDBao. QueryRk( ) ;
2025-01-21 15:36:19 +08:00
begin
with ADOQuery1 do
begin
close;
sql. Clear;
sql. Add( 'select A.*,hC_ps=A.AordQty2,JY_ps=(select count(MainID) from WFB_MJJY X where X.APID=A.APID),' ) ;
sql. Add( 'JY_Qty=(select sum(MJLen) from WFB_MJJY X where X.APID=A.APID), ' ) ;
sql. Add( 'RK_RollNum=(select sum(SOrdQty1) from CK_BanCP_CR X where X.APID=A.APID and X.CRType=' '<27> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ' '),' ) ;
sql. Add( 'RK_Qty=(select sum(MJLen) from CK_BanCP_CR X where X.APID=A.APID and X.CRType=' '<27> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ' ') ' ) ;
sql. Add( 'from JYOrder_sub_anPai A ' ) ;
2026-02-05 17:27:52 +08:00
SQL. Add( 'WHERE exists(select MJID from WFB_MJJY X where X.APID=A.APID and X.MJID=' + quotedstr( trim( smNO. Text ) ) ) ;
2025-01-21 15:36:19 +08:00
sql. Add( ')' ) ;
open;
end ;
end ;
2026-02-05 17:27:52 +08:00
function TfrmCPDBao. SaveRK( ) : Boolean ;
2025-01-21 15:36:19 +08:00
var
2026-02-05 17:27:52 +08:00
maxno: string ;
CRID: Integer ;
MaxCkNo, MaxCkSubNo: string ;
MhcTime: TdateTime;
2025-01-21 15:36:19 +08:00
begin
2026-02-05 17:27:52 +08:00
Result : = false ;
2025-01-21 15:36:19 +08:00
ADOQueryCmd. Connection. BeginTrans;
try
{ with ADOQueryTmp do
begin
Close;
sql. Clear;
SQL. add( 'Update CK_BanCP_CRID Set CRID=CRID+1' ) ;
sql. Add( 'select * from CK_BanCP_CRID' ) ;
Open;
end ;
CRID: = ADOQueryTmp. fieldbyname( 'CRID' ) . AsInteger;
if GetLSNo( ADOQueryTmp, MaxCkNo, 'JR' , 'CK_BanCP_CR' , 4 , 1 ) = False then
begin
ADOQueryCmd. Connection. RollbackTrans;
Application. MessageBox( 'ȡ<> <C8A1> Ʒ <EFBFBD> ֿ<EFBFBD> <D6BF> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ʧ<EFBFBD> ܣ<EFBFBD> ' , '<27> <> ʾ ' , 0 ) ;
Exit;
end ;
with ADOQueryCmd do
begin
Close;
sql. Clear;
sql. Add( 'select * from CK_BanCP_CR where 1<>1' ) ;
Open;
end ;
mhcTime: = SGetServerDateTime( ADOQueryTmp) ;
with ADOQueryCmd do
begin
Append;
FieldByName( 'MainId' ) . Value: = Trim( ADOQueryMain. fieldbyname( 'MainId' ) . AsString) ;
FieldByName( 'SubId' ) . Value: = Trim( ADOQueryMain. fieldbyname( 'SubId' ) . AsString) ;
FieldByName( 'C_Code' ) . Value: = Trim( ADOQueryMain. fieldbyname( 'PRTCode' ) . AsString) ;
FieldByName( 'C_CodeName' ) . Value: = Trim( ADOQueryMain. fieldbyname( 'PRTCodeName' ) . AsString) ;
//FieldByName('C_SPec').Value:=Trim(ADOQueryMain.fieldbyname('C_SPec').AsString);
FieldByName( 'C_Color' ) . Value: = Trim( ADOQueryMain. fieldbyname( 'PRTColor' ) . AsString) ;
FieldByName( 'APID' ) . Value: = Trim( ADOQueryMain. fieldbyname( 'APID' ) . AsString) ;
FieldByName( 'MJID' ) . Value: = Trim( ADOQueryMain. fieldbyname( 'MJId' ) . AsString) ;
FieldByName( 'mjxh' ) . Value: = Trim( ADOQueryMain. fieldbyname( 'mjxh' ) . AsString) ;
FieldByName( 'BaoNo' ) . Value: = Trim( BaoNo. Text ) ;
FieldByName( 'BaoID' ) . Value: = Trim( BaoID. Text ) ;
FieldByName( 'BCID' ) . Value: = Trim( MaxCkNo) ;
FieldByName( 'CRTime' ) . Value: = FormatDateTime( 'yyyy-MM-dd' , mhcTime) ;
FieldByName( 'CRFlag' ) . Value: = '<27> <> <EFBFBD> <EFBFBD> ' ;
FieldByName( 'CRType' ) . Value: = '<27> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ' ;
FieldByName( 'CRID' ) . Value: = CRID;
FieldByName( 'KGQty' ) . Value: = 0 ;
FieldByName( 'Qty' ) . Value: = ADOQueryMain. fieldbyname( 'MJLen' ) . Value;
FieldByName( 'RollNum' ) . Value: = 1 ;
FieldByName( 'QtyUnit' ) . Value: = ADOQueryMain. fieldbyname( 'MJTypeOther' ) . Value;
FieldByName( 'CPType' ) . Value: = ADOQueryMain. fieldbyname( 'MJType' ) . Value;
//FieldByName('Note').Value:=ADOQueryMain.fieldbyname('Note').Value;
FieldByName( 'Filler' ) . Value: = Trim( DName) ;
FieldByName( 'FillTime' ) . Value: = SGetServerDateTime( ADOQueryTmp) ;
//fieldbyname('kcKw').Value:=GetKw(ADOQueryTmp,ADOQueryMain.fieldbyname('PRTCodeName').AsString,ADOQueryMain.fieldbyname('PRTColor').AsString);
Post;
end ;
with ADOQueryCmd do
begin
Close;
sql. Clear;
sql. Add( 'select * from CK_BanCP_KC where 1<>1' ) ;
Open;
end ;
with ADOQueryCmd do
begin
Append;
FieldByName( 'CRID' ) . Value: = CRID;
FieldByName( 'BCID' ) . Value: = Trim( MaxCkNo) ;
FieldByName( 'CRTime' ) . Value: = FormatDateTime( 'yyyy-MM-dd' , mhcTime) ;
FieldByName( 'CRType' ) . Value: = '<27> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ' ;
FieldByName( 'CPType' ) . Value: = ADOQueryMain. fieldbyname( 'MJType' ) . Value;
FieldByName( 'C_Code' ) . Value: = Trim( ADOQueryMain. fieldbyname( 'PRTCode' ) . AsString) ;
FieldByName( 'C_CodeName' ) . Value: = Trim( ADOQueryMain. fieldbyname( 'PRTCodeName' ) . AsString) ;
//FieldByName('C_SPec').Value:=Trim(ADOQueryMain.fieldbyname('C_SPec').AsString);
FieldByName( 'C_Color' ) . Value: = Trim( ADOQueryMain. fieldbyname( 'PRTColor' ) . AsString) ;
FieldByName( 'BaoNo' ) . Value: = Trim( BaoNo. Text ) ;
FieldByName( 'BaoID' ) . Value: = Trim( BaoID. Text ) ;
FieldByName( 'MJID' ) . Value: = Trim( ADOQueryMain. fieldbyname( 'MJID' ) . AsString) ;
FieldByName( 'KCKGQty' ) . Value: = 0 ;
FieldByName( 'KCQty' ) . Value: = ADOQueryMain. fieldbyname( 'MJlen' ) . Value;
FieldByName( 'RollNum' ) . Value: = 1 ;
FieldByName( 'KCQtyUnit' ) . Value: = ADOQueryMain. fieldbyname( 'MJTypeOther' ) . Value;
FieldByName( 'mjxh' ) . Value: = Trim( ADOQueryMain. fieldbyname( 'mjxh' ) . AsString) ;
//FieldByName('KCNote').Value:=ADOQueryMain.fieldbyname('Note').Value;
//fieldbyname('kcKw').Value:=GetKw(ADOQueryTmp,ADOQueryMain.fieldbyname('PRTCodeName').AsString,ADOQueryMain.fieldbyname('PRTColor').AsString);
Post;
end ; }
with ADOQueryCmd do
begin
Close;
sql. Clear;
2026-02-05 17:27:52 +08:00
sql. Add( 'Update WFB_MJJY Set BaoNo=' '' + trim( BaoNo. Text ) + '' ',BaoID=' '' + trim( Baoid. text ) + '' ' where MJID=' '' + Trim( ADOQueryMain. fieldbyname( 'MJID' ) . AsString) + '' '' ) ;
2025-01-21 15:36:19 +08:00
ExecSQL;
end ;
ADOQueryCmd. Connection. CommitTrans;
2026-02-05 17:27:52 +08:00
Result : = true ;
2025-01-21 15:36:19 +08:00
except
ADOQueryCmd. Connection. RollbackTrans;
end ;
end ;
procedure TfrmCPDBao. InitGrid( ) ;
begin
with ADOQueryMain do
begin
Close;
sql. Clear;
SQL. Add( 'select A.*,B.*,C.MprtCodeName,C.orderNo as OrderNoM from WFB_MJJY A ' ) ;
sql. add( 'inner join JYOrder_Sub B on B.SubId=A.SubId' ) ;
sql. add( 'inner join JYOrder_Main C on C.maiNID=A.mainID' ) ;
SQL. Add( 'where 1=2 ' ) ;
Open;
end ;
2026-02-05 17:27:52 +08:00
SCreateCDS20( ADOQueryMain, CDSMJID) ;
SInitCDSData20( ADOQueryMain, CDSMJID) ;
SCreateCDS20( ADOQueryMain, CDSSEL) ;
SInitCDSData20( ADOQueryMain, CDSSEL) ;
2025-01-21 15:36:19 +08:00
end ;
procedure TfrmCPDBao. InitMJID( ) ;
begin
2026-02-05 17:27:52 +08:00
MovePanel1. Visible : = false ;
2025-01-21 15:36:19 +08:00
with ADOQueryMain do
begin
Close;
sql. Clear;
SQL. Add( 'select A.*,B.*,C.MprtCodeName,C.orderNo as OrderNoM from WFB_MJJY A ' ) ;
sql. add( 'inner join JYOrder_Sub B on B.SubId=A.SubId' ) ;
sql. add( 'inner join JYOrder_Main C on C.maiNID=A.mainID' ) ;
2026-02-05 17:27:52 +08:00
sql. Add( 'where MJID=' + quotedstr( trim( SmNO. Text ) ) ) ;
2025-01-21 15:36:19 +08:00
Open;
2026-02-05 17:27:52 +08:00
if not IsEmpty then
2025-01-21 15:36:19 +08:00
begin
2026-02-05 17:27:52 +08:00
if trim( Fieldbyname( 'MJstr2' ) . AsString) = '<27> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ' then
2025-01-21 15:36:19 +08:00
begin
CDSMJID. Append;
2026-02-05 17:27:52 +08:00
CDSMJID. FieldByName( 'SDefNote' ) . Value : = '<27> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ' ;
CDSMJID. FieldByName( 'MJID' ) . Value : = trim( SmNO. Text ) ;
2025-01-21 15:36:19 +08:00
CDSMJID. Post;
end
else
begin
2026-02-05 17:27:52 +08:00
CDSMJID. Append;
CDSMJID. FieldByName( 'SDefNote' ) . Value : = '<27> <> <EFBFBD> <EFBFBD> <EFBFBD> ɹ<EFBFBD> ' ;
CDSMJID. FieldByName( 'MJID' ) . Value : = trim( ADOQueryMain. Fieldbyname( 'MJID' ) . AsString) ;
2025-01-21 15:36:19 +08:00
// CDSMJID.FieldByName('CRID').Value:=trim(ADOQueryMain.Fieldbyname('CRID').AsString);
2026-02-05 17:27:52 +08:00
CDSMJID. FieldByName( 'PRTCodeName' ) . Value : = trim( ADOQueryMain. Fieldbyname( 'PRTCodeName' ) . AsString) ;
CDSMJID. FieldByName( 'MPRTCodeName' ) . Value : = trim( ADOQueryMain. Fieldbyname( 'MPRTCodeName' ) . AsString) ;
CDSMJID. FieldByName( 'PRTColor' ) . Value : = trim( ADOQueryMain. Fieldbyname( 'PRTColor' ) . AsString) ;
CDSMJID. FieldByName( 'PRTHX' ) . Value : = trim( ADOQueryMain. Fieldbyname( 'PRTHX' ) . AsString) ;
CDSMJID. FieldByName( 'MJStr4' ) . Value : = trim( ADOQueryMain. Fieldbyname( 'MJStr4' ) . AsString) ;
CDSMJID. FieldByName( 'MJType' ) . Value : = trim( ADOQueryMain. Fieldbyname( 'MJType' ) . AsString) ;
CDSMJID. FieldByName( 'BaoNo' ) . Value : = trim( BaoNo. Text ) ;
CDSMJID. FieldByName( 'BaoID' ) . Value : = trim( BaoID. Text ) ;
CDSMJID. FieldByName( 'SOrdQty1' ) . Value : = 1 ;
CDSMJID. FieldByName( 'MJLen' ) . Value : = ADOQueryMain. Fieldbyname( 'MJLen' ) . AsFloat;
CDSMJID. FieldByName( 'MJMaoZ' ) . Value : = ADOQueryMain. Fieldbyname( 'MJMaoZ' ) . AsFloat;
CDSMJID. FieldByName( 'MJQty3' ) . Value : = ADOQueryMain. Fieldbyname( 'MJQty3' ) . AsFloat;
CDSMJID. FieldByName( 'MJQty4' ) . Value : = ADOQueryMain. Fieldbyname( 'MJQty4' ) . AsFloat;
CDSMJID. FieldByName( 'MJTypeOther' ) . Value : = trim( ADOQueryMain. Fieldbyname( 'MJTypeOther' ) . AsString) ;
CDSMJID. FieldByName( 'mainID' ) . Value : = trim( ADOQueryMain. Fieldbyname( 'mainID' ) . AsString) ;
CDSMJID. FieldByName( 'subID' ) . Value : = trim( ADOQueryMain. Fieldbyname( 'subID' ) . AsString) ;
CDSMJID. Post;
Rolls : = Rolls + 1 ;
2025-01-21 15:36:19 +08:00
end ;
end
else
begin
CDSMJID. Append;
2026-02-05 17:27:52 +08:00
CDSMJID. FieldByName( 'SDefNote' ) . Value : = '<27> <> <EFBFBD> <EFBFBD> <EFBFBD> 벻<EFBFBD> <EBB2BB> <EFBFBD> <EFBFBD> ' ;
CDSMJID. FieldByName( 'MJID' ) . Value : = trim( SmNO. Text ) ;
2025-01-21 15:36:19 +08:00
CDSMJID. Post;
end ;
end ;
2026-02-05 17:27:52 +08:00
if trim( CDSMJID. FieldByName( 'SDefNote' ) . AsString) < > '<27> <> <EFBFBD> <EFBFBD> <EFBFBD> ɹ<EFBFBD> ' then
2025-01-21 15:36:19 +08:00
begin
2026-02-05 17:27:52 +08:00
MovePanel1. Visible : = true ;
Edit2. Text : = SmNO. Text ;
Label2. Caption : = trim( CDSMJID. FieldByName( 'SDefNote' ) . AsString) ;
if FileExists( PChar( ExtractFilePath( Application. ExeName) + 'wav\<5C> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> .wav' ) ) then
PlaySound( PChar( ExtractFilePath( Application. ExeName) + 'wav\<5C> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> .wav' ) , 0 , SND_ASYNC) ;
2025-01-21 15:36:19 +08:00
CDSMJID. delete;
end ;
2026-02-05 17:27:52 +08:00
if CDSTM. Locate( 'MJID' , trim( smno. Text ) , [ ] ) then
2025-01-21 15:36:19 +08:00
begin
// application.MessageBox('AAAA','AAAAAAAA',0);
CDSTM. Delete;
tv2. Controller. EditingController. ShowEdit( ) ;
tv3. Controller. EditingController. ShowEdit( ) ;
end ;
2026-02-05 17:27:52 +08:00
if CheckBox1. Checked = true then
2025-01-21 15:36:19 +08:00
begin
2026-02-05 17:27:52 +08:00
if ( Rolls = strtointdef( trim( ComboBox3. Text ) , 0 ) ) and ( strtointdef( trim( ComboBox3. Text ) , 0 ) > 0 ) then
2025-01-21 15:36:19 +08:00
begin
FileName. Click;
end ;
end ;
end ;
procedure TfrmCPDBao. FormDestroy( Sender: TObject) ;
begin
2026-02-05 17:27:52 +08:00
frmCPDBao : = nil ;
2025-01-21 15:36:19 +08:00
end ;
2026-02-05 17:27:52 +08:00
procedure TfrmCPDBao. FormClose( Sender: TObject; var Action: TCloseAction) ;
2025-01-21 15:36:19 +08:00
begin
//writeCxGrid(self.Caption+tv1.Name,Tv1,'<27> <> Ʒ <EFBFBD> ֿ<EFBFBD> ');
2026-02-05 17:27:52 +08:00
writeCxGrid( self. Caption + Tv2. Name , Tv2, '<27> <> Ʒ <EFBFBD> ֿ<EFBFBD> ' ) ;
writeCxGrid( self. Caption + Tv3. Name + '1' , Tv3, '<27> <> Ʒ <EFBFBD> ֿ<EFBFBD> ' ) ;
writeCxGrid( self. Caption + Tv4. Name , Tv4, '<27> <> Ʒ <EFBFBD> ֿ<EFBFBD> ' ) ;
Action : = cafree;
2025-01-21 15:36:19 +08:00
end ;
procedure TfrmCPDBao. TBCloseClick( Sender: TObject) ;
begin
close;
end ;
procedure TfrmCPDBao. FormCreate( Sender: TObject) ;
begin
2026-02-05 17:27:52 +08:00
Panel2. Align : = alClient;
2025-01-21 15:36:19 +08:00
//readCxGrid(self.Caption+tv1.Name,Tv1,'<27> <> Ʒ <EFBFBD> ֿ<EFBFBD> ');
2026-02-05 17:27:52 +08:00
readCxGrid( self. Caption + Tv2. Name , Tv2, '<27> <> Ʒ <EFBFBD> ֿ<EFBFBD> ' ) ;
readCxGrid( self. Caption + Tv3. Name + '1' , Tv3, '<27> <> Ʒ <EFBFBD> ֿ<EFBFBD> ' ) ;
readCxGrid( self. Caption + Tv4. Name , Tv4, '<27> <> Ʒ <EFBFBD> ֿ<EFBFBD> ' ) ;
Rolls : = 0 ;
2025-01-21 15:36:19 +08:00
end ;
procedure TfrmCPDBao. SmNOKeyPress( Sender: TObject; var Key: Char ) ;
begin
2026-02-05 17:27:52 +08:00
if Key = #13 then
2025-01-21 15:36:19 +08:00
begin
2026-02-05 17:27:52 +08:00
if combobox4. Text = '<27> <> <EFBFBD> <EFBFBD> ɫ' then
2025-01-21 15:36:19 +08:00
begin
with ADOQuery2 do
begin
close;
sql. clear;
sql. add( 'select B.PRTCOLOR,MaxBaoNo=isnull(max(cast(baoNo as int)),0)+1 ' ) ;
sql. add( 'from WFB_MJJY A ' ) ;
sql. add( 'inner join JYOrder_Sub B on A.SubId=B.SubId ' ) ;
2026-02-05 17:27:52 +08:00
sql. add( 'where A.MainId=' + quotedstr( trim( CDSTM. fieldbyname( 'MainID' ) . AsString) ) ) ;
sql. add( 'and B.PRTColor=(select PRTColor from WFB_MJJY WM inner join JYOrder_Sub JS on WM.SubId=JS.SubId where WM.MJID=' '' + trim( smno. Text ) + '' ')' ) ;
2025-01-21 15:36:19 +08:00
open;
end ;
2026-02-05 17:27:52 +08:00
if cdsmjid. IsEmpty = false then
2025-01-21 15:36:19 +08:00
begin
2026-02-05 17:27:52 +08:00
if self. ADOQuery2. FieldByName( 'prtcolor' ) . asstring < > cdsmjid. FieldByName( 'prtcolor' ) . AsString then
2025-01-21 15:36:19 +08:00
begin
2026-02-05 17:27:52 +08:00
MovePanel1. Visible : = true ;
Edit2. Text : = SmNO. Text ;
Label2. Caption : = '<27> <> ɫ<EFBFBD> <C9AB> ͬ<EFBFBD> <CDAC> <EFBFBD> <EFBFBD> <EFBFBD> ܴ<EFBFBD> <DCB4> <EFBFBD> <EFBFBD> <EFBFBD> ' ;
smno. Text : = '' ;
2025-01-21 15:36:19 +08:00
smno. SetFocus;
exit;
end ;
end ;
2026-02-05 17:27:52 +08:00
baoNo. text : = ADOQuery2. fieldbyname( 'MaxBaoNo' ) . AsString;
2025-01-21 15:36:19 +08:00
end ;
2026-02-05 17:27:52 +08:00
if trim( BaoNo. Text ) = '' then
2025-01-21 15:36:19 +08:00
begin
2026-02-05 17:27:52 +08:00
application. MessageBox( '<27> <> <EFBFBD> Ų<EFBFBD> <C5B2> <EFBFBD> Ϊ<EFBFBD> <CEAA> ' , '<27> <> ʾ ' ) ;
2025-01-21 15:36:19 +08:00
exit;
end ;
2026-02-05 17:27:52 +08:00
if trim( BaoID. Text ) = '' then
2025-01-21 15:36:19 +08:00
begin
2026-02-05 17:27:52 +08:00
application. MessageBox( '<27> <> <EFBFBD> <EFBFBD> <EFBFBD> 벻<EFBFBD> <EBB2BB> Ϊ<EFBFBD> <CEAA> ' , '<27> <> ʾ ' ) ;
2025-01-21 15:36:19 +08:00
exit;
end ;
2026-02-05 17:27:52 +08:00
if CDSTM. IsEmpty then
exit;
if trim( smno. Text ) = '' then
exit;
if CDSMJID. Locate( 'MJID' , trim( smno. Text ) , [ ] ) then
2025-01-21 15:36:19 +08:00
begin
2026-02-05 17:27:52 +08:00
MovePanel1. Visible : = true ;
Edit2. Text : = SmNO. Text ;
Label2. Caption : = '<27> ˾<EFBFBD> <CBBE> <EFBFBD> <EFBFBD> ظ<EFBFBD> ɨ<EFBFBD> 裡' ;
if FileExists( PChar( ExtractFilePath( Application. ExeName) + 'wav\<5C> ظ<EFBFBD> ɨ<EFBFBD> <C9A8> .wav' ) ) then
PlaySound( PChar( ExtractFilePath( Application. ExeName) + 'wav\<5C> ظ<EFBFBD> ɨ<EFBFBD> <C9A8> .wav' ) , 0 , SND_ASYNC) ;
smno. Text : = '' ;
2025-01-21 15:36:19 +08:00
smno. SetFocus;
exit;
end ;
2026-02-05 17:27:52 +08:00
if not CDSTM. Locate( 'MJID' , trim( smno. Text ) , [ ] ) then
2025-01-21 15:36:19 +08:00
begin
with ADOQuery1 do
begin
Close;
sql. Clear;
SQL. Add( 'select A.*,B.*,C.MprtCodeName,C.OrderNO as orderNoM from WFB_MJJY A ' ) ;
sql. add( 'inner join JYOrder_Sub B on B.SubId=A.SubId' ) ;
sql. add( 'inner join JYOrder_Main C on C.maiNID=A.mainID' ) ;
2026-02-05 17:27:52 +08:00
sql. Add( 'where MJID=' + quotedstr( trim( SmNO. Text ) ) ) ;
2025-01-21 15:36:19 +08:00
Open;
2026-02-05 17:27:52 +08:00
if isempty then
2025-01-21 15:36:19 +08:00
begin
2026-02-05 17:27:52 +08:00
MovePanel1. Visible : = true ;
Edit2. Text : = SmNO. Text ;
Label2. Caption : = '<27> ˾<EFBFBD> <CBBE> Ŵ<EFBFBD> <C5B4> <EFBFBD> <EFBFBD> <EFBFBD> ' ;
if FileExists( PChar( ExtractFilePath( Application. ExeName) + 'wav\ɨ<> <C9A8> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> .wav' ) ) then
PlaySound( PChar( ExtractFilePath( Application. ExeName) + 'wav\ɨ<> <C9A8> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> .wav' ) , 0 , SND_ASYNC) ;
2025-01-21 15:36:19 +08:00
end
else
begin
2026-02-05 17:27:52 +08:00
if not CDSTM. Locate( 'orderNoM' , trim( fieldbyname( 'OrderNoM' ) . AsString) , [ ] ) then
2025-01-21 15:36:19 +08:00
begin
2026-02-05 17:27:52 +08:00
MovePanel1. Visible : = true ;
Edit2. Text : = SmNO. Text ;
Label2. Caption : = '<27> ˾<EFBFBD> <CBBE> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ڵ<EFBFBD> ǰ<EFBFBD> <C7B0> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ' ;
if FileExists( PChar( ExtractFilePath( Application. ExeName) + 'wav\ɨ<> <C9A8> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> .wav' ) ) then
PlaySound( PChar( ExtractFilePath( Application. ExeName) + 'wav\ɨ<> <C9A8> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> .wav' ) , 0 , SND_ASYNC) ;
2025-01-21 15:36:19 +08:00
end
else
begin
2026-02-05 17:27:52 +08:00
if Fieldbyname( 'MJstr2' ) . AsString < > 'δ<> <CEB4> <EFBFBD> <EFBFBD> ' then
2025-01-21 15:36:19 +08:00
begin
2026-02-05 17:27:52 +08:00
MovePanel1. Visible : = true ;
Edit2. Text : = SmNO. Text ;
Label2. Caption : = fieldbyname( 'Mjstr2' ) . AsString;
2025-01-21 15:36:19 +08:00
end
else
begin
2026-02-05 17:27:52 +08:00
if self. ADOQuery1. FieldByName( 'baoid' ) . AsString < > '' then
2025-01-21 15:36:19 +08:00
begin
2026-02-05 17:27:52 +08:00
MovePanel1. Visible : = true ;
Edit2. Text : = SmNO. Text ;
Label2. Caption : = '<27> ˾<EFBFBD> <CBBE> Ѵ <EFBFBD> <D1B4> <EFBFBD> <EFBFBD> <EFBFBD> ' ;
2025-01-21 15:36:19 +08:00
end
else
begin
initMJID( ) ;
end ;
end ;
end ;
end ;
end ;
2026-02-05 17:27:52 +08:00
smno. Text : = '' ;
2025-01-21 15:36:19 +08:00
smno. SetFocus;
exit;
end
else
begin
initMJID( ) ;
end ;
2026-02-05 17:27:52 +08:00
smno. Text : = '' ;
2025-01-21 15:36:19 +08:00
smno. SetFocus;
end ;
end ;
procedure TfrmCPDBao. FormShow( Sender: TObject) ;
begin
2026-02-05 17:27:52 +08:00
MovePanel1. Left : = ( Width - MovePanel1. Width) div 2 ;
MovePanel1. top : = ( Height - MovePanel1. Height - 2 0 0 ) div 2 ;
2025-01-21 15:36:19 +08:00
// InitGrid();
end ;
2026-02-05 17:27:52 +08:00
procedure TfrmCPDBao. TV2CustomDrawCell( Sender: TcxCustomGridTableView; ACanvas: TcxCanvas; AViewInfo: TcxGridTableDataCellViewInfo; var ADone: Boolean ) ;
2025-01-21 15:36:19 +08:00
var
2026-02-05 17:27:52 +08:00
i: integer ;
2025-01-21 15:36:19 +08:00
begin
2026-02-05 17:27:52 +08:00
i : = tv2. GetColumnByFieldName( 'SDefNote' ) . Index ;
if ( AViewInfo. GridRecord. Values[ i] < > '<27> <> <EFBFBD> <EFBFBD> <EFBFBD> ɹ<EFBFBD> ' ) then
ACanvas. Brush. Color : = clred;
2025-01-21 15:36:19 +08:00
end ;
procedure TfrmCPDBao. kcKwBtnClick( Sender: TObject) ;
begin
try
2026-02-05 17:27:52 +08:00
frmZDYHelp : = TfrmZDYHelp. Create( Application) ;
2025-01-21 15:36:19 +08:00
with frmZDYHelp do
begin
2026-02-05 17:27:52 +08:00
flag : = 'CPKWFlag' ;
flagname : = '<27> <> λ<EFBFBD> <CEBB> Ϣ' ;
V1Name. Caption : = '<27> <> λ<EFBFBD> <CEBB> <EFBFBD> <EFBFBD> ' ;
V1Note. Caption : = 'Ӣ<> <D3A2> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ' ;
2025-01-21 15:36:19 +08:00
// MainType:=Trim(DName);
2026-02-05 17:27:52 +08:00
fnote : = FALSE ;
if ShowModal = 1 then
2025-01-21 15:36:19 +08:00
begin
2026-02-05 17:27:52 +08:00
kcKw. Text : = Trim( ClientDataSet1. fieldbyname( 'ZDYName' ) . AsString) ;
2025-01-21 15:36:19 +08:00
end ;
end ;
finally
frmZDYHelp. Free;
end ;
end ;
procedure TfrmCPDBao. Button4Click( Sender: TObject) ;
begin
2026-02-05 17:27:52 +08:00
MovePanel1. Visible : = False ;
2025-01-21 15:36:19 +08:00
SmNO. SetFocus;
end ;
procedure TfrmCPDBao. baoNoKeyPress( Sender: TObject; var Key: Char ) ;
2026-02-05 17:27:52 +08:00
var
FBaoID: string ;
2025-01-21 15:36:19 +08:00
begin
end ;
procedure TfrmCPDBao. baoNoClick( Sender: TObject) ;
var
2026-02-05 17:27:52 +08:00
i: Integer ;
2025-01-21 15:36:19 +08:00
begin
// Panel3.Visible:=True;
{ with Panel3 do
begin
for i: = 0 to ControlCount- 1 do
begin
if Controls[ i] is TSpeedButton then
begin
TSpeedButton( Controls[ i] ) . Hint: = Trim( TEdit( Sender) . Name ) ;
end ;
end ;
end ; }
end ;
procedure TfrmCPDBao. SpeedButton1Click( Sender: TObject) ;
var
2026-02-05 17:27:52 +08:00
fsj: string ;
2025-01-21 15:36:19 +08:00
begin
2026-02-05 17:27:52 +08:00
fsj : = Trim( TSpeedButton( Sender) . Hint) ;
if Trim( fsj) = '' then
Exit;
fsj : = Trim( TEdit( FindComponent( Trim( TSpeedButton( Sender) . Hint) ) ) . Text ) ;
TEdit( FindComponent( Trim( TSpeedButton( Sender) . Hint) ) ) . Text : = fsj + Trim( TSpeedButton( Sender) . Caption) ;
2025-01-21 15:36:19 +08:00
TEdit( FindComponent( Trim( TSpeedButton( Sender) . Hint) ) ) . SelectAll;
end ;
procedure TfrmCPDBao. SpeedButton12Click( Sender: TObject) ;
var
2026-02-05 17:27:52 +08:00
fsj: string ;
2025-01-21 15:36:19 +08:00
begin
2026-02-05 17:27:52 +08:00
fsj : = Trim( TEdit( FindComponent( Trim( TSpeedButton( Sender) . Hint) ) ) . Text ) ;
if Trim( fsj) = '' then
Exit;
TEdit( FindComponent( Trim( TSpeedButton( Sender) . Hint) ) ) . Text : = Copy( fsj, 1 , Length( fsj) - 1 ) ;
2025-01-21 15:36:19 +08:00
TEdit( FindComponent( Trim( TSpeedButton( Sender) . Hint) ) ) . SelectAll;
end ;
2026-02-05 17:27:52 +08:00
2025-01-21 15:36:19 +08:00
procedure TfrmCPDBao. SpeedButton49Click( Sender: TObject) ;
var
2026-02-05 17:27:52 +08:00
FBaoID: string ;
2025-01-21 15:36:19 +08:00
begin
2026-02-05 17:27:52 +08:00
if trim( TEdit( FindComponent( Trim( TSpeedButton( Sender) . Hint) ) ) . Hint) < > '' then
2025-01-21 15:36:19 +08:00
begin
2026-02-05 17:27:52 +08:00
if GetLSNo( ADOQueryTmp, FBaoID, 'BI' , 'WFB_MJJY' , 4 , 1 ) = False then
2025-01-21 15:36:19 +08:00
begin
ADOQueryCmd. Connection. RollbackTrans;
2026-02-05 17:27:52 +08:00
Application. MessageBox( 'ȡ<> <C8A1> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ʧ<EFBFBD> ܣ<EFBFBD> ' , '<27> <> ʾ ' , 0 ) ;
2025-01-21 15:36:19 +08:00
Exit;
end ;
2026-02-05 17:27:52 +08:00
BaoID. Text : = trim( FBaoID) ;
2025-01-21 15:36:19 +08:00
end ;
2026-02-05 17:27:52 +08:00
Panel3. Visible : = False ;
2025-01-21 15:36:19 +08:00
end ;
procedure TfrmCPDBao. FileNameClick( Sender: TObject) ;
2026-02-05 17:27:52 +08:00
var
fPrintFile: string ;
Txt, fImagePath: string ;
Moudle: THandle;
Makebar: TMakebar;
Mixtext: TMixtext;
FBaoID: string ;
i: Integer ;
2025-01-21 15:36:19 +08:00
begin
2026-02-05 17:27:52 +08:00
if trim( BaoID. Text ) = '' then
2025-01-21 15:36:19 +08:00
begin
2026-02-05 17:27:52 +08:00
application. MessageBox( '<27> <> <EFBFBD> <EFBFBD> <EFBFBD> 벻<EFBFBD> <EBB2BB> δ<EFBFBD> <CEB4> ' , '<27> <> ʾ ' ) ;
2025-01-21 15:36:19 +08:00
exit;
end ;
2026-02-05 17:27:52 +08:00
if CDSMJID. IsEmpty then
exit;
2025-01-21 15:36:19 +08:00
with ADOQueryPrint do
begin
Close;
SQL. Clear;
sql. Add( ' SELECT D.LBName,D.NLBName' ) ;
sql. Add( ' from WFB_MJJY A' ) ;
sql. Add( ' inner join JYOrder_Main D on D.MainID=A.MainID' ) ;
2026-02-05 17:27:52 +08:00
SQL. Add( 'where MJID=' '' + Trim( CDSMJID. fieldbyname( 'MJID' ) . AsString) + '' '' ) ;
2025-01-21 15:36:19 +08:00
Open;
2026-02-05 17:27:52 +08:00
if not ADOQueryPrint. IsEmpty then
2025-01-21 15:36:19 +08:00
begin
2026-02-05 17:27:52 +08:00
if Trim( ADOQueryPrint. fieldbyname( 'NLBName' ) . AsString) = '' then
2025-01-21 15:36:19 +08:00
begin
2026-02-05 17:27:52 +08:00
application. MessageBox( 'û<> <C3BB> <EFBFBD> <EFBFBD> <EFBFBD> ð<EFBFBD> <C3B0> <EFBFBD> ǩ<EFBFBD> <C7A9> <EFBFBD> <EFBFBD> <EFBFBD> ܴ<EFBFBD> <DCB4> <EFBFBD> <EFBFBD> <EFBFBD> ' , '<27> <> ʾ <EFBFBD> <CABE> Ϣ' , 0 ) ;
2025-01-21 15:36:19 +08:00
exit;
end ;
end ;
end ;
ADOQueryCmd. Connection. BeginTrans;
try
2026-02-05 17:27:52 +08:00
with CDSMJID do
2025-01-21 15:36:19 +08:00
begin
DisableControls;
first;
while not eof do
begin
with ADOQueryCmd do
begin
Close;
sql. Clear;
2026-02-05 17:27:52 +08:00
sql. Add( 'Update WFB_MJJY Set BaoNo=' '' + trim( BaoNo. Text ) + '' ',BaoID=' '' + trim( Baoid. text ) + '' ' where MJID=' '' + Trim( CDSMJID. fieldbyname( 'MJID' ) . AsString) + '' '' ) ;
2025-01-21 15:36:19 +08:00
ExecSQL;
end ;
edit;
2026-02-05 17:27:52 +08:00
fieldByName( 'Sflag' ) . AsString : = '2' ;
fieldbyname( 'BaoNo' ) . Value : = trim( BaoNo. Text ) ;
fieldbyname( 'BaoID' ) . Value : = trim( BaoID. Text ) ;
2025-01-21 15:36:19 +08:00
post;
next;
end ;
EnableControls;
end ;
ADOQueryCmd. Connection. CommitTrans;
2026-02-05 17:27:52 +08:00
if FileExists( PChar( ExtractFilePath( Application. ExeName) + 'wav\<5C> <> ȷ.wav' ) ) then
PlaySound( PChar( ExtractFilePath( Application. ExeName) + 'wav\<5C> <> ȷ.wav' ) , 0 , SND_ASYNC) ;
2025-01-21 15:36:19 +08:00
except
ADOQueryCmd. Connection. RollbackTrans;
2026-02-05 17:27:52 +08:00
if FileExists( PChar( ExtractFilePath( Application. ExeName) + 'wav\<5C> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> .wav' ) ) then
PlaySound( PChar( ExtractFilePath( Application. ExeName) + 'wav\<5C> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> .wav' ) , 0 , SND_ASYNC) ;
application. MessageBox( '<27> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ʧ<EFBFBD> ܣ<EFBFBD> ' , '<27> <> ʾ <EFBFBD> <CABE> Ϣ' , 0 ) ;
2025-01-21 15:36:19 +08:00
exit;
end ;
{ if trim( BaoID. Text ) = '' then
begin
application. MessageBox( '<27> <> <EFBFBD> <EFBFBD> <EFBFBD> 벻<EFBFBD> <EBB2BB> δ<EFBFBD> <CEB4> ' , '<27> <> ʾ ' ) ;
exit;
end ; }
with ADOQueryPrint do
begin
Close;
SQL. Clear;
sql. Add( 'select A.Baoid,A.BaoNo,A.MJTypeOther as QtyUnit,D.OrderNo,D.conNo,D.customerNoName,D.MprtCodeName,D.Mprtspec,D.OrdPerson1,D.MPRTKuanNO,D.LBName,D.NLBName,' ) ;
sql. Add( 'PRTColor=DBO.F_Get_Order_SubStr(BaoID,' 'BNColor' '),SOrddefstr1=DBO.F_Get_Order_SubStr(BaoID,' 'BNSOrddefstr1' '),' ) ;
sql. Add( 'SOrddefstr4=DBO.F_Get_Order_SubStr(BaoID,' 'BNSOrddefstr4' '),PRtHX=DBO.F_Get_Order_SubStr(BaoID,' 'BNPRtHX' '), ' ) ;
sql. Add( 'Mjstr4=DBO.F_Get_Order_SubStr(BaoID,' 'BNGangNo' '), ' ) ;
sql. Add( 'BNMJLENLIST=DBO.F_Get_Order_SubStr(BaoID,' 'BNMJLENLIST' '), ' ) ;
sql. Add( 'PRTkuanNo=DBO.F_Get_Order_SubStr(BaoID,' 'BNPrtkuanno' '),' ) ;
sql. Add( 'khConNo=(select top 1 khConNo from JYOrderCon_Main X where X.ConNO=D.conNO), ' ) ;
sql. Add( 'MprtCodeNameEng=(select top 1 Note from KH_Zdy X where X.zdyName=D.MprtCodeName), ' ) ;
SQL. ADD( 'count(A.MJID) as JSl,sum(A.MJMaoZ) MJMAOZ,sum(MJQty3) as MJQty3,sum(MJQty4) as MJQty4,SUM(A.MJLen)as MJLen' ) ;
sql. Add( 'from WFB_MJJY A' ) ;
sql. Add( ' inner join JYOrder_Sub C on C.SubID=A.SubID' ) ;
sql. Add( ' inner join JYOrder_Main D on D.MainID=A.MainID' ) ;
2026-02-05 17:27:52 +08:00
SQL. Add( 'where A.BaoID=' '' + Trim( BaoID. Text ) + '' '' ) ;
2025-01-21 15:36:19 +08:00
SQL. ADD( 'group by A.Baoid,A.BaoNo,A.MJTypeOther,D.OrderNo,D.conNo,D.customerNoName,D.MprtCodeName,D.Mprtspec,D.OrdPerson1,D.MPRTKuanNO,D.LBName,D.NLBName' ) ;
Open;
end ;
2026-02-05 17:27:52 +08:00
if ADOQueryPrint. RecordCount > 1 then
2025-01-21 15:36:19 +08:00
begin
2026-02-05 17:27:52 +08:00
Application. MessageBox( '<27> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ´ <EFBFBD> <C2B4> <EFBFBD> !' , '<27> <> ʾ ' , 0 ) ;
if FileExists( PChar( ExtractFilePath( Application. ExeName) + 'wav\<5C> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> .wav' ) ) then
PlaySound( PChar( ExtractFilePath( Application. ExeName) + 'wav\<5C> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> .wav' ) , 0 , SND_ASYNC) ;
2025-01-21 15:36:19 +08:00
Exit;
end ;
2026-02-05 17:27:52 +08:00
if ADOQueryPrint. RecordCount < 1 then
2025-01-21 15:36:19 +08:00
begin
2026-02-05 17:27:52 +08:00
Application. MessageBox( '<27> ˰<EFBFBD> <CBB0> Ż<EFBFBD> δ<EFBFBD> <CEB4> <EFBFBD> <EFBFBD> <EFBFBD> 棬<EFBFBD> 뱣<EFBFBD> <EBB1A3> <EFBFBD> <EFBFBD> <EFBFBD> ݣ<EFBFBD> <DDA3> ڴ<EFBFBD> ӡ<EFBFBD> <D3A1> <EFBFBD> 룡' , '<27> <> ʾ ' , 0 ) ;
if FileExists( PChar( ExtractFilePath( Application. ExeName) + 'wav\<5C> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> .wav' ) ) then
PlaySound( PChar( ExtractFilePath( Application. ExeName) + 'wav\<5C> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> .wav' ) , 0 , SND_ASYNC) ;
2025-01-21 15:36:19 +08:00
Exit;
end ;
try
2026-02-05 17:27:52 +08:00
Moudle : = LoadLibrary( 'MakeQRBarcode.dll' ) ;
@ Makebar : = GetProcAddress( Moudle, 'Make' ) ;
@ Mixtext : = GetProcAddress( Moudle, 'MixText' ) ;
Txt : = trim( BaoID. Text ) ;
fImagePath : = ExtractFilePath( Application. ExeName) + 'image\temp.bmp' ;
if not DirectoryExists( pchar( ExtractFilePath( Application. ExeName) + 'image' ) ) then
CreateDirectory( pchar( ExtractFilePath( Application. ExeName) + 'image' ) , nil ) ;
if FileExists( fImagePath) then
DeleteFile( fImagePath) ;
Makebar( pchar( Txt) , Length( Txt) , 3 , 3 , 0 , PChar( fImagePath) , 3 ) ;
2025-01-21 15:36:19 +08:00
except
2026-02-05 17:27:52 +08:00
application. MessageBox( '<27> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ʧ<EFBFBD> ܣ<EFBFBD> ' , '<27> <> ʾ <EFBFBD> <CABE> Ϣ' , MB_ICONERROR) ;
2025-01-21 15:36:19 +08:00
exit;
end ;
2026-02-05 17:27:52 +08:00
baoNo. Text : = inttostr( strtointdef( trim( baoNo. Text ) , 0 ) + 1 ) ;
if GetLSNo( ADOQueryTmp, FBaoID, 'BI' , 'WFB_MJJY' , 4 , 1 ) = False then
begin
ADOQueryCmd. Connection. RollbackTrans;
Application. MessageBox( 'ȡ<> <C8A1> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ʧ<EFBFBD> ܣ<EFBFBD> ' , '<27> <> ʾ ' , 0 ) ;
Exit;
end ;
BaoID. Text : = trim( FBaoID) ;
CDSsel. Last;
with CDSMJID do
begin
DisableControls;
first;
while not eof do
2025-01-21 15:36:19 +08:00
begin
2026-02-05 17:27:52 +08:00
CDSsel. Append;
for i : = 0 to FieldCount - 1 do
2025-01-21 15:36:19 +08:00
begin
2026-02-05 17:27:52 +08:00
CDSsel. fields[ i] . value : = Fields[ i] . Value;
2025-01-21 15:36:19 +08:00
end ;
2026-02-05 17:27:52 +08:00
CDSsel. Post;
next;
2025-01-21 15:36:19 +08:00
end ;
2026-02-05 17:27:52 +08:00
EnableControls;
end ;
CDSMJID. EmptyDataSet;
2025-01-21 15:36:19 +08:00
2026-02-05 17:27:52 +08:00
if check_bz. Checked then
2025-01-21 15:36:19 +08:00
begin
2026-02-05 17:27:52 +08:00
if Trim( ADOQueryPrint. fieldbyname( 'NLBName' ) . AsString) < > '' then
fPrintFile : = ExtractFilePath( Application. ExeName) + 'Report\' + Trim( ADOQueryPrint. fieldbyname( 'NLBName' ) . AsString) + '.rmf' // fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + Trim(ADOQueryPrint.fieldbyname('NLBName').AsString)
2025-01-21 15:36:19 +08:00
else
2026-02-05 17:27:52 +08:00
// fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\<5C> <> <EFBFBD> <EFBFBD> ǩ.rmf';
fPrintFile : = ExtractFilePath( Application. ExeName) + 'Report\<5C> <> <EFBFBD> <EFBFBD> ǩ' ;
if not FileExists( fPrintFile) then
2025-01-21 15:36:19 +08:00
begin
2026-02-05 17:27:52 +08:00
Application. MessageBox( PChar( 'û<> <C3BB> <EFBFBD> <EFBFBD> ' + fPrintFile) , '<27> <> ʾ ' , 0 ) ;
2025-01-21 15:36:19 +08:00
Exit;
end ;
if FileExists( fPrintFile) then
begin
2026-02-05 17:27:52 +08:00
RMVariables[ 'QRBARCODE' ] : = fImagePath;
2025-01-21 15:36:19 +08:00
RM2. LoadFromFile( fPrintFile) ;
2026-02-05 17:27:52 +08:00
RM2. DefaultCopies : = strtointdef( trim( ComboBox1. Text ) , 1 ) ;
2025-01-21 15:36:19 +08:00
//RM2.ShowReport;
RM2. printReport;
2026-02-05 17:27:52 +08:00
end ;
2025-01-21 15:36:19 +08:00
end ;
2026-02-05 17:27:52 +08:00
Rolls : = 0 ;
2025-01-21 15:36:19 +08:00
SmNO. SetFocus;
{
IF check_Fbz. Checked then
begin
fPrintFile: = ExtractFilePath( Application. ExeName) + 'Report\' + Trim( Fbq. Text ) + '.rmf' ;
IF Not FileExists( fPrintFile) then
begin
Application. MessageBox( PChar( 'û<> <C3BB> <EFBFBD> <EFBFBD> ' + fPrintFile) , '<27> <> ʾ ' , 0 ) ;
Exit;
end ;
if FileExists( fPrintFile) then
begin
RMVariables[ 'QRBARCODE' ] : = fImagePath;
RM2. LoadFromFile( fPrintFile) ;
RM2. DefaultCopies: = strtointdef( trim( ComboBox2. Text ) , 1 ) ;
//RM2.ShowReport;
RM2. printReport;
end ;
end ;
}
end ;
procedure TfrmCPDBao. cxButton1Click( Sender: TObject) ;
begin
TBClose. Click;
end ;
procedure TfrmCPDBao. baoNoExit( Sender: TObject) ;
var
2026-02-05 17:27:52 +08:00
FBaoID: string ;
2025-01-21 15:36:19 +08:00
begin
2026-02-05 17:27:52 +08:00
if baoNo. Text < > '' then
begin
if GetLSNo( ADOQueryTmp, FBaoID, 'BI' , 'WFB_MJJY' , 4 , 1 ) = False then
2025-01-21 15:36:19 +08:00
begin
ADOQueryCmd. Connection. RollbackTrans;
2026-02-05 17:27:52 +08:00
Application. MessageBox( 'ȡ<> <C8A1> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ʧ<EFBFBD> ܣ<EFBFBD> ' , '<27> <> ʾ ' , 0 ) ;
2025-01-21 15:36:19 +08:00
Exit;
end ;
2026-02-05 17:27:52 +08:00
BaoID. Text : = trim( FBaoID) ;
end
else
BaoID. Text : = '' ;
2025-01-21 15:36:19 +08:00
end ;
procedure TfrmCPDBao. BtnEditA1BtnClick( Sender: TObject) ;
begin
2026-02-05 17:27:52 +08:00
frmOrderSelRK : = TfrmOrderSelRK. Create( Application) ;
with frmOrderSelRK do
begin
if ShowModal = 1 then
2025-01-21 15:36:19 +08:00
begin
2026-02-05 17:27:52 +08:00
CDS_OrderSel. DisableControls;
with CDS_OrderSel do
2025-01-21 15:36:19 +08:00
begin
2026-02-05 17:27:52 +08:00
First;
while not Eof do
2025-01-21 15:36:19 +08:00
begin
2026-02-05 17:27:52 +08:00
if FieldByName( 'SSel' ) . Value = True then
2025-01-21 15:36:19 +08:00
begin
2026-02-05 17:27:52 +08:00
BtnEditA1. Text : = trim( CDS_OrderSel. fieldbyname( 'OrderNo' ) . asstring) ;
2025-01-21 15:36:19 +08:00
end ;
2026-02-05 17:27:52 +08:00
Next;
2025-01-21 15:36:19 +08:00
end ;
end ;
2026-02-05 17:27:52 +08:00
CDS_OrderSel. EnableControls;
2025-01-21 15:36:19 +08:00
end ;
2026-02-05 17:27:52 +08:00
end ;
2025-01-21 15:36:19 +08:00
QueryTm( ) ;
end ;
procedure TfrmCPDBao. cxButton3Click( Sender: TObject) ;
var
2026-02-05 17:27:52 +08:00
i: integer ;
2025-01-21 15:36:19 +08:00
begin
2026-02-05 17:27:52 +08:00
if CDSMJID. IsEmpty then
exit;
if CDSMJID. fieldByName( 'Sflag' ) . AsString = '2' then
2025-01-21 15:36:19 +08:00
begin
2026-02-05 17:27:52 +08:00
application. MessageBox( '<27> Ѵ <EFBFBD> <D1B4> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ɾ<EFBFBD> <C9BE> <EFBFBD> <EFBFBD> ' , '<27> <> ʾ <EFBFBD> <CABE> Ϣ' , 0 ) ;
2025-01-21 15:36:19 +08:00
exit;
end
else
begin
with CDSMJID do
begin
CDSTM. Last;
2026-02-05 17:27:52 +08:00
CDSTM. Append;
for i : = 0 to FieldCount - 1 do
begin
CDSTM. fields[ i] . value : = Fields[ i] . Value;
end ;
CDSTM. Post;
2025-01-21 15:36:19 +08:00
end ;
CDSMJID. Delete;
2026-02-05 17:27:52 +08:00
Rolls : = Rolls - 1 ;
2025-01-21 15:36:19 +08:00
end ;
end ;
procedure TfrmCPDBao. cxButton2Click( Sender: TObject) ;
begin
2026-02-05 17:27:52 +08:00
if CDSMJID. IsEmpty then
exit;
2025-01-21 15:36:19 +08:00
ADOQueryCmd. Connection. BeginTrans;
try
2026-02-05 17:27:52 +08:00
with CDSMJID do
2025-01-21 15:36:19 +08:00
begin
DisableControls;
first;
while not eof do
begin
with ADOQueryCmd do
begin
Close;
sql. Clear;
2026-02-05 17:27:52 +08:00
sql. Add( 'Update WFB_MJJY Set BaoNo=' '' + trim( BaoNo. Text ) + '' ',BaoID=' '' + trim( Baoid. text ) + '' ' where MJID=' '' + Trim( CDSMJID. fieldbyname( 'MJID' ) . AsString) + '' '' ) ;
2025-01-21 15:36:19 +08:00
ExecSQL;
end ;
edit;
2026-02-05 17:27:52 +08:00
fieldByName( 'Sflag' ) . AsString : = '2' ;
fieldbyname( 'BaoNo' ) . Value : = trim( BaoNo. Text ) ;
fieldbyname( 'BaoID' ) . Value : = trim( BaoID. Text ) ;
2025-01-21 15:36:19 +08:00
post;
next;
end ;
EnableControls;
end ;
ADOQueryCmd. Connection. CommitTrans;
// application.MessageBox('<27> <> <EFBFBD> <EFBFBD> <EFBFBD> ijɹ<C4B3> <C9B9> <EFBFBD> ','<27> <> ʾ <EFBFBD> <CABE> Ϣ',0);
except
ADOQueryCmd. Connection. RollbackTrans;
2026-02-05 17:27:52 +08:00
application. MessageBox( '<27> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ʧ<EFBFBD> ܣ<EFBFBD> ' , '<27> <> ʾ <EFBFBD> <CABE> Ϣ' , 0 ) ;
2025-01-21 15:36:19 +08:00
end ;
end ;
procedure TfrmCPDBao. cxButton4Click( Sender: TObject) ;
var
2026-02-05 17:27:52 +08:00
FBaoid: string ;
2025-01-21 15:36:19 +08:00
begin
2026-02-05 17:27:52 +08:00
if CDSSEL. IsEmpty then
Exit;
if CDSSEL. Locate( 'SSel' , True , [ ] ) = False then
2025-01-21 15:36:19 +08:00
begin
2026-02-05 17:27:52 +08:00
Application. MessageBox( 'û<> <C3BB> ѡ <EFBFBD> <D1A1> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> !' , '<27> <> ʾ ' , 0 ) ;
2025-01-21 15:36:19 +08:00
Exit;
end ;
try
CDSSEL. DisableControls;
// ADOQueryCmd.Connection.BeginTrans;
with CDSSEL do
begin
2026-02-05 17:27:52 +08:00
// First;
while CDSSEL. Locate( 'SSel' , True , [ ] ) do
2025-01-21 15:36:19 +08:00
begin
with ADOQueryCmd do
begin
Close;
sql. Clear;
sql. Add( 'Update WFB_MJJY Set baoID=' '' ',baoNo=' '' ' ' ) ;
2026-02-05 17:27:52 +08:00
sql. Add( 'where MJID=' '' + Trim( CDSSEL. fieldbyname( 'MJID' ) . AsString) + '' '' ) ;
2025-01-21 15:36:19 +08:00
ExecSQL;
end ;
delete;
2026-02-05 17:27:52 +08:00
2025-01-21 15:36:19 +08:00
end ;
2026-02-05 17:27:52 +08:00
2025-01-21 15:36:19 +08:00
end ;
// ADOQueryCmd.Connection.CommitTrans;
CDSSEL. EnableControls;
2026-02-05 17:27:52 +08:00
application. MessageBox( '<27> <> <EFBFBD> ݳ<EFBFBD> <DDB3> <EFBFBD> <EFBFBD> ɹ<EFBFBD> <C9B9> <EFBFBD> ' , '<27> <> ʾ <EFBFBD> <CABE> Ϣ' ) ;
2025-01-21 15:36:19 +08:00
2026-02-05 17:27:52 +08:00
with ADOQueryTM do
2025-01-21 15:36:19 +08:00
begin
close;
2026-02-05 17:27:52 +08:00
sql. Clear;
sql. Add( 'select A.*,B.*,C.MPrtCodeName,C.orderNo as OrderNoM' ) ;
sql. Add( 'from WFB_MJJY A ' ) ;
sql. Add( 'inner join JYOrder_sub B on B.subID=A.subID ' ) ;
sql. Add( 'inner join JYOrder_main C on C.mainID=A.MainID ' ) ;
sql. Add( ' and A.mjstr2=' 'δ<> <CEB4> <EFBFBD> <EFBFBD> ' ' and C.orderNo=' + quotedstr( trim( BtnEditA1. Text ) ) ) ;
2025-01-21 15:36:19 +08:00
open;
end ;
2026-02-05 17:27:52 +08:00
SCreateCDS20( ADOQueryTM, CDSTM) ;
SInitCDSData20( ADOQueryTM, CDSTM) ;
if not CDSTM. IsEmpty then
2025-01-21 15:36:19 +08:00
begin
2026-02-05 17:27:52 +08:00
with ADOQuery1 do
begin
close;
sql. clear;
sql. add( 'select isnull(max(cast(baoNo as int)),0)+1 as MaxBaoNo from WFB_MJJY ' ) ;
sql. Add( 'where mainID=' + quotedstr( trim( CDSTM. fieldbyname( 'MainID' ) . AsString) ) ) ;
open;
end ;
baoNo. text : = ADOQuery1. fieldbyname( 'MaxBaoNo' ) . AsString;
if GetLSNo( ADOQueryTmp, FBaoid, 'BI' , 'WFB_MJJY' , 4 , 1 ) = False then
begin
ADOQueryCmd. Connection. RollbackTrans;
Application. MessageBox( 'ȡ<> <C8A1> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ʧ<EFBFBD> ܣ<EFBFBD> ' , '<27> <> ʾ ' , 0 ) ;
Exit;
end ;
BaoID. Text : = trim( FBaoid) ;
2025-01-21 15:36:19 +08:00
end ;
2026-02-05 17:27:52 +08:00
SMNO. SetFocus;
cxButton5. Click;
2025-01-21 15:36:19 +08:00
exit;
except
// ADOQueryCmd.Connection.RollbackTrans;
CDSSEL. EnableControls;
2026-02-05 17:27:52 +08:00
application. MessageBox( '<27> <> <EFBFBD> ݳ<EFBFBD> <DDB3> <EFBFBD> ʧ<EFBFBD> ܣ<EFBFBD> ' , '<27> <> ʾ <EFBFBD> <CABE> Ϣ' , 0 ) ;
2025-01-21 15:36:19 +08:00
end ;
2026-02-05 17:27:52 +08:00
// if CDSSEL.IsEmpty then
// Exit;
// if CDSSEL.Locate('SSel', True, []) = False then
// begin
// Application.MessageBox('û<> <C3BB> ѡ <EFBFBD> <D1A1> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> !', '<27> <> ʾ ', 0);
// Exit;
// end;
// try
// CDSSEL.DisableControls;
// // ADOQueryCmd.Connection.BeginTrans;
// with CDSSEL do
// begin
// First;
// while FieldByName('SSel').AsBoolean do
// begin
// with ADOQueryCmd do
// begin
// Close;
// sql.Clear;
// sql.Add('Update WFB_MJJY Set baoID='''',baoNo='''' ');
// sql.Add('where MJID=''' + Trim(CDSSEL.fieldbyname('MJID').AsString) + '''');
// ExecSQL;
// end;
// delete;
// end;
// end;
// // ADOQueryCmd.Connection.CommitTrans;
// CDSSEL.EnableControls;
// application.MessageBox('<27> <> <EFBFBD> ݳ<EFBFBD> <DDB3> <EFBFBD> <EFBFBD> ɹ<EFBFBD> <C9B9> <EFBFBD> ', '<27> <> ʾ <EFBFBD> <CABE> Ϣ');
//
// with ADOQueryTM do
// begin
// close;
// sql.Clear;
// sql.Add('select A.*,B.*,C.MPrtCodeName,C.orderNo as OrderNoM');
// sql.Add('from WFB_MJJY A ');
// sql.Add('inner join JYOrder_sub B on B.subID=A.subID ');
// sql.Add('inner join JYOrder_main C on C.mainID=A.MainID ');
// sql.Add('and A.mjstr2=''δ<> <CEB4> <EFBFBD> <EFBFBD> '' and C.orderNo=' + quotedstr(trim(BtnEditA1.Text)));
// open;
// end;
// SCreateCDS20(ADOQueryTM, CDSTM);
// SInitCDSData20(ADOQueryTM, CDSTM);
//
// if not CDSTM.IsEmpty then
// begin
// with ADOQuery1 do
// begin
// close;
// sql.clear;
// sql.add('select isnull(max(cast(baoNo as int)),0)+1 as MaxBaoNo from WFB_MJJY ');
// sql.Add('where mainID=' + quotedstr(trim(CDSTM.fieldbyname('MainID').AsString)));
// open;
// end;
// baoNo.text := ADOQuery1.fieldbyname('MaxBaoNo').AsString;
// if GetLSNo(ADOQueryTmp, FBaoid, 'BI', 'WFB_MJJY', 4, 1) = False then
// begin
// ADOQueryCmd.Connection.RollbackTrans;
// Application.MessageBox('ȡ<> <C8A1> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ʧ<EFBFBD> ܣ<EFBFBD> ', '<27> <> ʾ ', 0);
// Exit;
// end;
// BaoID.Text := trim(FBaoid);
// end;
//
// SMNO.SetFocus;
// exit;
// except
// // ADOQueryCmd.Connection.RollbackTrans;
// CDSSEL.EnableControls;
// application.MessageBox('<27> <> <EFBFBD> ݳ<EFBFBD> <DDB3> <EFBFBD> ʧ<EFBFBD> ܣ<EFBFBD> ', '<27> <> ʾ <EFBFBD> <CABE> Ϣ', 0);
// end;
2025-01-21 15:36:19 +08:00
end ;
procedure TfrmCPDBao. FbqBtnClick( Sender: TObject) ;
begin
try
2026-02-05 17:27:52 +08:00
frmZDYHelp : = TfrmZDYHelp. Create( Application) ;
2025-01-21 15:36:19 +08:00
with frmZDYHelp do
begin
2026-02-05 17:27:52 +08:00
flag : = 'BAOFFLAG' ;
flagname : = '<27> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ǩ' ;
if ShowModal = 1 then
2025-01-21 15:36:19 +08:00
begin
2026-02-05 17:27:52 +08:00
Fbq. Text : = trim( ClientDataSet1. fieldbyname( 'zdyName' ) . AsString) ;
2025-01-21 15:36:19 +08:00
end ;
end ;
finally
frmZDYHelp. Free;
end ;
end ;
procedure TfrmCPDBao. BaoBqBtnClick( Sender: TObject) ;
type
2026-02-05 17:27:52 +08:00
TMyFunc = function( App: Tapplication; FormH: hwnd; FormID: integer ; Language: integer ; WinStyle: integer ; GCode: Pchar ; GName: Pchar ; DataBase: Pchar ; Title: PChar ; Parameters1: PChar ; Parameters2: PChar ; Parameters3: PChar ; Parameters4: PChar ; Parameters5: PChar ; Parameters6: PChar ; Parameters7: PChar ; Parameters8: PChar ; Parameters9: PChar ; Parameters10: PChar ; DataBaseStr: PChar ) : hwnd; stdcall ;
2025-01-21 15:36:19 +08:00
var
Tf: TMyFunc;
Tp: TFarProc;
2026-02-05 17:27:52 +08:00
Th: Thandle;
LabInt, labname: string ;
2025-01-21 15:36:19 +08:00
begin
//if PPInt=2 then Exit;
2026-02-05 17:27:52 +08:00
Ddatabase : = StringOfChar( ' ' , 3 2 ) ;
2025-01-21 15:36:19 +08:00
Th : = LoadLibrary( 'LabelSet.dll' ) ;
if Th > 0 then
begin
try
Tp : = GetProcAddress( Th, 'GetDllForm' ) ;
if Tp < > nil then
begin
Tf : = TMyFunc( Tp) ;
2026-02-05 17:27:52 +08:00
newh : = Tf( Application, 0 , 2 , 0 , 0 , PChar( DCode) , PChar( DName) , PChar( Ddatabase) , PChar( '<27> <> ǩģ<C7A9> <C4A3> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ' ) , PChar( '' ) , PChar( '' ) , '' , '' , '' , '' , '' , '' , '' , '' , PChar( DConString) ) ;
if Trim( PChar( Ddatabase) ) < > '' then
begin
Ddatabase : = Trim( PChar( Ddatabase) ) ;
2025-01-21 15:36:19 +08:00
// LabInt:=Trim( LeftBStr(Ddatabase,Pos('|',Ddatabase)-1) ) ;
2026-02-05 17:27:52 +08:00
BaoBq. Text : = Trim( RightBStr( Ddatabase, Length( Ddatabase) - Pos( '|' , Ddatabase) ) ) ;
end ;
2025-01-21 15:36:19 +08:00
end
else
begin
ShowMessage( '<27> <> ӡִ<D3A1> д<EFBFBD> <D0B4> <EFBFBD> ' ) ;
end ;
finally
// FreeLibrary();
end ;
end
else
begin
2026-02-05 17:27:52 +08:00
ShowMessage( '<27> Ҳ<EFBFBD> <D2B2> <EFBFBD> ' + Trim( 'LabelSet.dll' ) ) ;
2025-01-21 15:36:19 +08:00
end ;
end ;
procedure TfrmCPDBao. cxButton5Click( Sender: TObject) ;
begin
QueryTm( ) ;
end ;
procedure TfrmCPDBao. cxButton6Click( Sender: TObject) ;
begin
2026-02-05 17:27:52 +08:00
if CDSTM. IsEmpty then
exit;
if trim( BaoNo. Text ) = '' then
2025-01-21 15:36:19 +08:00
begin
2026-02-05 17:27:52 +08:00
application. MessageBox( '<27> <> <EFBFBD> Ų<EFBFBD> <C5B2> <EFBFBD> Ϊ<EFBFBD> <CEAA> ' , '<27> <> ʾ ' ) ;
2025-01-21 15:36:19 +08:00
exit;
end ;
2026-02-05 17:27:52 +08:00
if trim( BaoID. Text ) = '' then
2025-01-21 15:36:19 +08:00
begin
2026-02-05 17:27:52 +08:00
application. MessageBox( '<27> <> <EFBFBD> <EFBFBD> <EFBFBD> 벻<EFBFBD> <EBB2BB> Ϊ<EFBFBD> <CEAA> ' , '<27> <> ʾ ' ) ;
2025-01-21 15:36:19 +08:00
exit;
end ;
with CDSTM do
begin
DisableControls;
// first;
2026-02-05 17:27:52 +08:00
while Locate( 'ssel' , true , [ ] ) do
2025-01-21 15:36:19 +08:00
begin
2026-02-05 17:27:52 +08:00
if combobox4. Text = '<27> <> <EFBFBD> <EFBFBD> ɫ' then
2025-01-21 15:36:19 +08:00
begin
2026-02-05 17:27:52 +08:00
if cdsmjid. IsEmpty = false then
2025-01-21 15:36:19 +08:00
begin
2026-02-05 17:27:52 +08:00
if cdstm. FieldByName( 'PRTCOLOR' ) . AsString < > cdsmjid. FieldByName( 'prtcolor' ) . AsString then
2025-01-21 15:36:19 +08:00
begin
2026-02-05 17:27:52 +08:00
MovePanel1. Visible : = true ;
Edit2. Text : = SmNO. Text ;
Label2. Caption : = '<27> <> ɫ<EFBFBD> <C9AB> ͬ<EFBFBD> <CDAC> <EFBFBD> <EFBFBD> <EFBFBD> ܴ<EFBFBD> <DCB4> <EFBFBD> <EFBFBD> <EFBFBD> ' ;
label2. Font. Size : = 3 6 ;
smno. Text : = '' ;
2025-01-21 15:36:19 +08:00
smno. SetFocus;
EnableControls;
exit;
end ;
end ;
with ADOQuery2 do
begin
close;
sql. clear;
sql. add( 'select MaxBaoNo=isnull(max(cast(baoNo as int)),0)+1 ' ) ;
sql. add( 'from WFB_MJJY A ' ) ;
sql. add( 'inner join JYOrder_Sub B on A.SubId=B.SubId ' ) ;
2026-02-05 17:27:52 +08:00
sql. add( 'where A.MainId=' + quotedstr( trim( CDSTM. fieldbyname( 'MainID' ) . AsString) ) ) ;
sql. add( 'and B.PRTColor=(select PRTColor from WFB_MJJY WM inner join JYOrder_Sub JS on WM.SubId=JS.SubId where WM.MJID=' '' + trim( self. CDSTM. fieldbyname( 'mjid' ) . AsString) + '' ')' ) ;
2025-01-21 15:36:19 +08:00
// showmessage(sql.Text);
open;
end ;
2026-02-05 17:27:52 +08:00
baoNo. text : = ADOQuery2. fieldbyname( 'MaxBaoNo' ) . AsString;
2025-01-21 15:36:19 +08:00
end ;
2026-02-05 17:27:52 +08:00
if CDSMJID. Locate( 'MJID' , trim( CDSTM. fieldbyname( 'MJID' ) . AsString) , [ ] ) then
2025-01-21 15:36:19 +08:00
begin
2026-02-05 17:27:52 +08:00
MovePanel1. Visible : = true ;
Edit2. Text : = SmNO. Text ;
Label2. Caption : = '<27> ˾<EFBFBD> <CBBE> <EFBFBD> <EFBFBD> ظ<EFBFBD> ɨ<EFBFBD> 裡' ;
smno. Text : = '' ;
2025-01-21 15:36:19 +08:00
smno. SetFocus;
EnableControls;
exit;
end ;
CDSMJID. Append;
2026-02-05 17:27:52 +08:00
CDSMJID. FieldByName( 'SDefNote' ) . Value : = '<27> <> <EFBFBD> <EFBFBD> <EFBFBD> ɹ<EFBFBD> ' ;
CDSMJID. FieldByName( 'MJID' ) . Value : = trim( Fieldbyname( 'MJID' ) . AsString) ;
2025-01-21 15:36:19 +08:00
// CDSMJID.FieldByName('CRID').Value:=trim(ADOQueryMain.Fieldbyname('CRID').AsString);
2026-02-05 17:27:52 +08:00
CDSMJID. FieldByName( 'PRTCodeName' ) . Value : = trim( Fieldbyname( 'PRTCodeName' ) . AsString) ;
CDSMJID. FieldByName( 'MPRTCodeName' ) . Value : = trim( Fieldbyname( 'MPRTCodeName' ) . AsString) ;
CDSMJID. FieldByName( 'PRTColor' ) . Value : = trim( Fieldbyname( 'PRTColor' ) . AsString) ;
CDSMJID. FieldByName( 'PRTHX' ) . Value : = trim( Fieldbyname( 'PRTHX' ) . AsString) ;
CDSMJID. FieldByName( 'MJStr4' ) . Value : = trim( Fieldbyname( 'MJStr4' ) . AsString) ;
CDSMJID. FieldByName( 'MJType' ) . Value : = trim( Fieldbyname( 'MJType' ) . AsString) ;
CDSMJID. FieldByName( 'BaoNo' ) . Value : = trim( BaoNo. Text ) ;
CDSMJID. FieldByName( 'BaoID' ) . Value : = trim( BaoID. Text ) ;
CDSMJID. FieldByName( 'SOrdQty1' ) . Value : = 1 ;
CDSMJID. FieldByName( 'MJLen' ) . Value : = Fieldbyname( 'MJLen' ) . AsFloat;
CDSMJID. FieldByName( 'MJMaoZ' ) . Value : = Fieldbyname( 'MJMaoZ' ) . AsFloat;
CDSMJID. FieldByName( 'MJQty3' ) . Value : = Fieldbyname( 'MJQty3' ) . AsFloat;
CDSMJID. FieldByName( 'MJQty4' ) . Value : = Fieldbyname( 'MJQty4' ) . AsFloat;
CDSMJID. FieldByName( 'MJTypeOther' ) . Value : = trim( Fieldbyname( 'MJTypeOther' ) . AsString) ;
CDSMJID. FieldByName( 'mainID' ) . Value : = trim( Fieldbyname( 'mainID' ) . AsString) ;
CDSMJID. FieldByName( 'subID' ) . Value : = trim( Fieldbyname( 'subID' ) . AsString) ;
2025-01-21 15:36:19 +08:00
CDSMJID. Post;
CDSTM. Delete;
tv2. Controller. EditingController. ShowEdit( ) ;
tv3. Controller. EditingController. ShowEdit( ) ;
end ;
first;
EnableControls;
end ;
end ;
procedure TfrmCPDBao. cxButton7Click( Sender: TObject) ;
begin
2026-02-05 17:27:52 +08:00
SDofilter( ADOQueryTM, SGetFilters( Panel5, 1 , 2 ) ) ;
SCreateCDS20( ADOQueryTM, CDSTM) ;
SInitCDSData20( ADOQueryTM, CDSTM) ;
end ;
procedure TfrmCPDBao. N1Click( Sender: TObject) ;
begin
SelOKNoFiler( Tv4, True ) ;
end ;
procedure TfrmCPDBao. N2Click( Sender: TObject) ;
begin
SelOKNoFiler( Tv4, False ) ;
end ;
procedure TfrmCPDBao. cxButton8Click( Sender: TObject) ;
var
fPrintFile: string ;
Txt, fImagePath: string ;
Moudle: THandle;
Makebar: TMakebar;
Mixtext: TMixtext;
FBaoID: string ;
i: Integer ;
begin
if CDSSEL. IsEmpty then
exit;
with ADOQueryPrint do
begin
Close;
SQL. Clear;
sql. Add( ' SELECT D.LBName,D.NLBName' ) ;
sql. Add( ' from WFB_MJJY A' ) ;
sql. Add( ' inner join JYOrder_Main D on D.MainID=A.MainID' ) ;
SQL. Add( 'where MJID=' '' + Trim( CDSSEL. fieldbyname( 'MJID' ) . AsString) + '' '' ) ;
Open;
if not ADOQueryPrint. IsEmpty then
begin
if Trim( ADOQueryPrint. fieldbyname( 'NLBName' ) . AsString) = '' then
begin
application. MessageBox( 'û<> <C3BB> <EFBFBD> <EFBFBD> <EFBFBD> ð<EFBFBD> <C3B0> <EFBFBD> ǩ<EFBFBD> <C7A9> <EFBFBD> <EFBFBD> <EFBFBD> ܴ<EFBFBD> <DCB4> <EFBFBD> <EFBFBD> <EFBFBD> ' , '<27> <> ʾ <EFBFBD> <CABE> Ϣ' , 0 ) ;
exit;
end ;
end ;
end ;
with ADOQueryPrint do
begin
Close;
SQL. Clear;
sql. Add( 'select A.Baoid,A.BaoNo,A.MJTypeOther as QtyUnit,D.OrderNo,D.conNo,D.customerNoName,D.MprtCodeName,D.Mprtspec,D.OrdPerson1,D.MPRTKuanNO,D.LBName,D.NLBName,' ) ;
sql. Add( 'PRTColor=DBO.F_Get_Order_SubStr(BaoID,' 'BNColor' '),SOrddefstr1=DBO.F_Get_Order_SubStr(BaoID,' 'BNSOrddefstr1' '),' ) ;
sql. Add( 'SOrddefstr4=DBO.F_Get_Order_SubStr(BaoID,' 'BNSOrddefstr4' '),PRtHX=DBO.F_Get_Order_SubStr(BaoID,' 'BNPRtHX' '), ' ) ;
sql. Add( 'Mjstr4=DBO.F_Get_Order_SubStr(BaoID,' 'BNGangNo' '), ' ) ;
sql. Add( 'BNMJLENLIST=DBO.F_Get_Order_SubStr(BaoID,' 'BNMJLENLIST' '), ' ) ;
sql. Add( 'PRTkuanNo=DBO.F_Get_Order_SubStr(BaoID,' 'BNPrtkuanno' '),' ) ;
sql. Add( 'khConNo=(select top 1 khConNo from JYOrderCon_Main X where X.ConNO=D.conNO), ' ) ;
sql. Add( 'MprtCodeNameEng=(select top 1 Note from KH_Zdy X where X.zdyName=D.MprtCodeName), ' ) ;
SQL. ADD( 'count(A.MJID) as JSl,sum(A.MJMaoZ) MJMAOZ,sum(MJQty3) as MJQty3,sum(MJQty4) as MJQty4,SUM(A.MJLen)as MJLen' ) ;
sql. Add( 'from WFB_MJJY A' ) ;
sql. Add( ' inner join JYOrder_Sub C on C.SubID=A.SubID' ) ;
sql. Add( ' inner join JYOrder_Main D on D.MainID=A.MainID' ) ;
SQL. Add( 'where A.BaoID=' '' + Trim( CDSSEL. fieldbyname( 'BaoID' ) . AsString) + '' '' ) ;
SQL. ADD( 'group by A.Baoid,A.BaoNo,A.MJTypeOther,D.OrderNo,D.conNo,D.customerNoName,D.MprtCodeName,D.Mprtspec,D.OrdPerson1,D.MPRTKuanNO,D.LBName,D.NLBName' ) ;
Open;
end ;
if ADOQueryPrint. RecordCount > 1 then
begin
Application. MessageBox( '<27> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ´ <EFBFBD> <C2B4> <EFBFBD> !' , '<27> <> ʾ ' , 0 ) ;
if FileExists( PChar( ExtractFilePath( Application. ExeName) + 'wav\<5C> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> .wav' ) ) then
PlaySound( PChar( ExtractFilePath( Application. ExeName) + 'wav\<5C> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> .wav' ) , 0 , SND_ASYNC) ;
Exit;
end ;
if ADOQueryPrint. RecordCount < 1 then
begin
Application. MessageBox( '<27> ˰<EFBFBD> <CBB0> Ż<EFBFBD> δ<EFBFBD> <CEB4> <EFBFBD> <EFBFBD> <EFBFBD> 棬<EFBFBD> 뱣<EFBFBD> <EBB1A3> <EFBFBD> <EFBFBD> <EFBFBD> ݣ<EFBFBD> <DDA3> ڴ<EFBFBD> ӡ<EFBFBD> <D3A1> <EFBFBD> 룡' , '<27> <> ʾ ' , 0 ) ;
if FileExists( PChar( ExtractFilePath( Application. ExeName) + 'wav\<5C> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> .wav' ) ) then
PlaySound( PChar( ExtractFilePath( Application. ExeName) + 'wav\<5C> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> .wav' ) , 0 , SND_ASYNC) ;
Exit;
end ;
try
Moudle : = LoadLibrary( 'MakeQRBarcode.dll' ) ;
@ Makebar : = GetProcAddress( Moudle, 'Make' ) ;
@ Mixtext : = GetProcAddress( Moudle, 'MixText' ) ;
Txt : = trim( BaoID. Text ) ;
fImagePath : = ExtractFilePath( Application. ExeName) + 'image\temp.bmp' ;
if not DirectoryExists( pchar( ExtractFilePath( Application. ExeName) + 'image' ) ) then
CreateDirectory( pchar( ExtractFilePath( Application. ExeName) + 'image' ) , nil ) ;
if FileExists( fImagePath) then
DeleteFile( fImagePath) ;
Makebar( pchar( Txt) , Length( Txt) , 3 , 3 , 0 , PChar( fImagePath) , 3 ) ;
except
application. MessageBox( '<27> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> ʧ<EFBFBD> ܣ<EFBFBD> ' , '<27> <> ʾ <EFBFBD> <CABE> Ϣ' , MB_ICONERROR) ;
exit;
end ;
if check_bz. Checked then
begin
if Trim( ADOQueryPrint. fieldbyname( 'NLBName' ) . AsString) < > '' then
fPrintFile : = ExtractFilePath( Application. ExeName) + 'Report\' + Trim( ADOQueryPrint. fieldbyname( 'NLBName' ) . AsString) + '.rmf' // fPrintFile := ExtractFilePath(Application.ExeName) + 'Report\' + Trim(ADOQueryPrint.fieldbyname('NLBName').AsString)
else
fPrintFile : = ExtractFilePath( Application. ExeName) + 'Report\<5C> <> <EFBFBD> <EFBFBD> ǩ.rmf' ;
if not FileExists( fPrintFile) then
begin
Application. MessageBox( PChar( 'û<> <C3BB> <EFBFBD> <EFBFBD> ' + fPrintFile) , '<27> <> ʾ ' , 0 ) ;
Exit;
end ;
if FileExists( fPrintFile) then
begin
RMVariables[ 'QRBARCODE' ] : = fImagePath;
RM2. LoadFromFile( fPrintFile) ;
RM2. DefaultCopies : = strtointdef( trim( ComboBox1. Text ) , 1 ) ;
//RM2.ShowReport;
RM2. printReport;
end ;
end ;
2025-01-21 15:36:19 +08:00
end ;
end .
2026-02-05 17:27:52 +08:00