public bool InsertOrUpdate(DataRow dtTRansOrderLine) { string PO = dtTRansOrderLine["KEYID"].ToString(); var Exstinct = CheckExstinctRow(PO, "99", ""); if (Exstinct) { var update1 = UpdateLotforFinishedGood(dtTRansOrderLine, "99", "0020"); var update2 = UpdateLotforFinishedGood(dtTRansOrderLine, "130", "0020"); DeleteRowIntoWarehouseEmptyStock(PO, "130"); if ((update1 && update2) == false) { SystemLog.Output(SystemLog.MSG_TYPE.War, "InsertLOTForFinishedGoods", ""); } else { return(true); } } else { WMS.Controller.ConvertDataTable convertDataTable = new WMS.Controller.ConvertDataTable(); DataTable dtLot = convertDataTable.GetDataTableLOT(dtTRansOrderLine, 99); var insert = InsertData(dtLot); var update2 = UpdateLotforFinishedGood(dtTRansOrderLine, "130", "0020"); DeleteRowIntoWarehouseEmptyStock(PO, "130"); if ((insert) == false) { SystemLog.Output(SystemLog.MSG_TYPE.War, "InsertLOTForFinishedGoods", ""); } return(true); } return(true); }
public bool InsertOrUpdateIntoWH(DataTable dtERPPQC) { for (int i = 0; i < dtERPPQC.Rows.Count; i++) { string PO = dtERPPQC.Rows[i]["ProductOrder"].ToString(); var Exstinct = CheckExstinctRow(PO, "130", "0020"); if (Exstinct) { var update1 = UpdateLotforIntoWH(dtERPPQC.Rows[i], "50"); var update2 = UpdateLotforIntoWH(dtERPPQC.Rows[i], "130"); if ((update1 && update2) == false) { SystemLog.Output(SystemLog.MSG_TYPE.War, "InsertLOTForFinishedGoods", ""); } } else { WMS.Controller.ConvertDataTable convertDataTable = new WMS.Controller.ConvertDataTable(); DataTable dtLot = convertDataTable.GetDataTableLOTbyERP(dtERPPQC.Rows[i], 130); var insert = InsertData(dtLot); var update1 = UpdateLotforIntoWH(dtERPPQC.Rows[i], "50"); if ((insert) == false) { SystemLog.Output(SystemLog.MSG_TYPE.War, "InsertLOTForFinishedGoods", ""); } } } return(true); }
public bool UpdateOrInsert(DataTable dtERPPQC, int [] WS_Sequence) { try { for (int i = 0; i < dtERPPQC.Rows.Count; i++) { //if(CheckExstinctRow(dtERPPQC.Rows[i]["ProductOrder"].ToString(),"0020","B02","B01")) //{ // var update = UpdateOPREALRUN(dtERPPQC.Rows[i]["ProductOrder"].ToString(), "0020", "B02", "B01", dtERPPQC.Rows[i]); //} //else { WMS.Controller.ConvertDataTable convertDataTable = new WMS.Controller.ConvertDataTable(); DataTable dtREALRUN = convertDataTable.ConvertToREALRUN(dtERPPQC.Rows[i], WS_Sequence[i]); var insert = InsertData(dtREALRUN); var update = UpdateOPREALRUN(dtERPPQC.Rows[i]["ProductOrder"].ToString(), "0020", "B02", "B01", dtERPPQC.Rows[i]); } } return(true); } catch (Exception ex) { SystemLog.Output(SystemLog.MSG_TYPE.Err, "UpdateOrInsert(DataTable dtERPPQC)", ex.Message); return(false); } }