TADOQuery * pUpdate=dmLocal - & gt; PUpdate_gChpi2;
if(! PUpdate - & gt; Connection - & gt; InTransaction)
PUpdate - & gt; Connection - & gt; BeginTrans ();
Try
{
PUpdate - & gt; Active=false;
PUpdate - & gt; SQL - & gt; The Clear ();
//1. Insert table finished-parts storage
PUpdate - & gt; SQL - & gt; Add (" INSERT INTO gChpi2 (BoxNo BoxNum, spNo, inDate, OutFlag, TPID, EPCID, SJMZ, SJJZ, SJTJ) \
The select xh, fxnum, '" + lblHWId - & gt; Caption. The Trim () + "', getdate (), 0, '" + RFIDScanBillInfor [iIndex] sTuoPanId +"', EPCID, isnull (MXJZ, 0), isnull (MXJZ, 0) + isnull (XZZL, 0), isnull (XZC, 0) * isnull (XZK, 0) * isnull (XZG, 0) from DFXXH \
Where xh in (" + slstBoxNo + ") ");
PUpdate - & gt; ExecSQL ();
//2. Insert finished-product stock list
PUpdate - & gt; Active=false;
PUpdate - & gt; SQL - & gt; The Clear ();
PUpdate - & gt; SQL - & gt; Add (" insert into gChpi2Mx (BoxNO scMxid, scCode, SCCF, color, pino, Num, poxh, Po) select a.x h, a.s cMXID, b.s cCode, a.s CCF, a.h color, \
Amy polumbo ino, a.f xnum, p. oxh, Amy polumbo o the from DXFMX a inner join DFXXH on a.x h=b b.x h and a.x h in (" + slstBoxNo + ") ");
PUpdate - & gt; ExecSQL ();
//3./location update status table
PUpdate - & gt; Active=false;
PUpdate - & gt; SQL - & gt; The Clear ();
PUpdate - & gt; SQL - & gt; Add (" update kw set status=1, TPH='" + RFIDScanBillInfor [iIndex] sTuoPanId. The Trim () + "' where hw='" + lblHWId - & gt; Caption. The Trim () + "'");
PUpdate - & gt; ExecSQL ();
//4. Update box sign schedule of storage, warehousing application form
PUpdate - & gt; Active=false;
PUpdate - & gt; SQL - & gt; The Clear ();
PUpdate - & gt; SQL - & gt; Add (" update DFXXH set rksign=1 where xh in (" + slstBoxNo + "); The update RCKQR set isok=1 where TPH='" + RFIDScanBillInfor [iIndex] sTuoPanId. The Trim () + "' and BQH (" + slstBoxNo + ") and in type='" + RFIDCheckBillInfor [iIndex] sDataType + "';" );
PUpdate - & gt; ExecSQL ();
PUpdate - & gt; Connection - & gt; CommitTrans ();
}
}
The catch (Exception & amp; Msg)
{
PUpdate - & gt; Connection - & gt; RollbackTrans ();
SEMsg="data save failed, please try again after checking!" + Msg. The Message;
BResult=false;
}
Cursorlocation connection is the default clUseClient
The probability of abnormal sometimes several times a day, the use of the system to the customer caused a lot of inconvenience, please master action! Thank you very much!
CodePudding user response:
Hair for a few days, how is still in the approval status?