เกิดจากการ
- ยกยอด PO มาผิดพลาด ลบ InventTrans แต่ไม่ได้ลงใน InventtransExt ด้วย
- หรือเกิดจากการ เปลี่ยน Invent Dim แก้ InventTrans เพื่อให้ Post เอกสารได้
Error ตามรูป
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgik_lN-jVjoPMFtWldAKViR108pS1OUsZW8JKZidLY0kfMdBnWgFi2NG5yETibbTXzu0_4z2xo_jVb8weNypMIRCQqhXDx6iB6ux0iUw5Hc-DmSzSV2MeEcRXZh1blssrkPP9Xf5j5LLc/s320/1.jpg)
วิธีแก้
1. เปิด Table InventTrans และ InventTransExt หา Item เดียวกัน และเปรียบเที่ยบว่าที่ Table InventTransExt Line ไหนที่ InventTransRecId ไม่ตรงกัน โดยดูจาก ที่ปิด Invent Error ตามรูป Tab Session --> Next Number ไปดูใน Calculation List ว่าเป็น Item อะไร ถ้าไม่มีให้สร้าง แต่ถ้ามีให้แก้ ดูข้อมูลให้ตรงกัน วันที่ InventtDimId และอื่น ๆ ถ้าสร้างต้องใส่ข้อมูลใน InventtransExt ให้ได้มากที่สุด
1.1. แล้ว Run Consistency Check Code นั้น ๆ
1.2. เข้า Run Calculation Help ในตรงที่ปิด Inventory แล้วดูลำดับต่อไป
2. เขียน code SQL หา InventransRecld ที่ไม่มีใน Inventtrans ใน Query Analyzer
[code=text]SELECT *
FROM INVENTTRANS
WHERE (RECID NOT IN
(SELECT InventTransRecId
FROM inventtransext))[/code]
2.1. นำ code มาสร้าง File ตามตัวอย่าง [attachment=1]21.ods[/attachment]
2.2. Save File เป็น File CSV ใช้ , คัน ตามตัวอย่าง [attachment=0]ItemInventTransExt.zip[/attachment]
2.3. ใช้ Job เอาเข้าเพื่อ Create InvettranExt Code
[code=text]static void UpdateInventTransExt(Args _args)
{
AsciiIO myFile;
container RecData;
int i;
InventTrans myInventTrans;
InventTransExt inventTransExt;
InventDim TableInventDim;
ItemId myItemId;
RecId myRecId;
inventDimId myinventDimId;
DateFinancial myDateFinancial;
DatePhysical myDatePhysical;
str DateStr;
str DateStr2;
;
myFile=new AsciiIO("D:\\Suwit\\ItemInventTransExt.csv", "r");
myfile.inFieldDelimiter(",");
WHILE(myFile.status() == IO_Status::Ok)
RecData += myFile.read();
myFile = null;
myFile=new AsciiIO("D:\\Suwit\\ItemInventTransExt-import.txt", "w");
ttsBegin;
for(i=1; i <= conlen(RecData); i++){
myItemId = conpeek(RecData, i);
i++;
myRecId = conpeek(RecData, i);
i++;
myinventDimId = conpeek(RecData, i);
i++;
DateStr = conpeek(RecData, i);
myDateFinancial = str2date(DateStr, 321);
i++;
DateStr2 = conpeek(RecData, i);
myDatePhysical = str2date(DateStr2, 321);
inventTransExt.clear();
inventTransExt.ItemId = myItemId;
inventTransExt.InventTransRecId = myRecId;
inventTransExt.InventDimId = myinventDimId;
TableInventDim = InventDim::find(myinventDimId);
inventTransExt.InventBatchId = TableInventDim.inventBatchId;
inventTransExt.WMSLocationId = TableInventDim.wMSLocationId;
inventTransExt.InventLocationId = TableInventDim.InventLocationId;
inventTransExt.InventColorId = TableInventDim.InventColorId;
inventTransExt.InventSerialId = TableInventDim.InventSerialId;
inventTransExt.InventSizeId = TableInventDim.InventSizeId;
inventTransExt.ConfigId = TableInventDim.ConfigId;
inventTransExt.DateFinancial = myDateFinancial;
inventTransExt.DatePhysical = myDatePhysical;
inventTransExt.insert();
myFile.write(strfmt("%1\t%2\t%3\t%4\t%5\t%6", inventTransExt.ItemId, inventTransExt.InventTransRecId, inventTransExt.InventDimId, inventTransExt.DateFinancial, inventTransExt.DatePhysical, inventTransExt.InventBatchId));
}
ttsCommit;
myFile = null;
info("complete");
}[/code]
2.3. Run Calculation Help อีกที และระบบจะทำการปิด Inventtory ต่อ
No comments:
Post a Comment