public static void SaveQCData(string InspectionNo, QCType qcType, LotNonActiveInfo lot, EquipmentInfo equipment, string batchID, QCStatus status, string objectType, TransactionStamp txnStamp) { QCInspectionInfoEx inspection = null; var lotNonActiveInfoEx = lot.ChangeTo <LotNonActiveInfoEx>(); #region 產生檢驗單 inspection = InfoCenter.Create <QCInspectionInfo>().ChangeTo <QCInspectionInfoEx>(); inspection.InspectionNo = InspectionNo; inspection.QCTYPE = qcType.ToCimesString(); inspection.OperationName = lotNonActiveInfoEx.OperationName; inspection.EquipmentName = equipment.EquipmentName; inspection.DeviceName = lotNonActiveInfoEx.DeviceName; inspection.BatchID = batchID; inspection.Status = status.ToCimesString(); inspection.CreateUser = txnStamp.UserID; inspection.CreateTime = txnStamp.RecordTime; inspection.InsertToDB(txnStamp.UserID, txnStamp.RecordTime); #endregion if (inspection == null) { //檢驗單主檔沒有資料 throw new Exception(TextMessage.Error.T00060("QCData")); } #region 產生檢驗單對象 //新增一筆資料到MES_QC_INSP_OBJ var inspectionObject = InfoCenter.Create <QCInspectionObjectInfo>(); if (inspectionObject.InfoState == InfoState.NewCreate) { inspectionObject.QC_INSP_SID = inspection.QC_INSP_SID; inspectionObject.ObjectType = objectType; inspectionObject.OBJECTSID = lotNonActiveInfoEx.ID; inspectionObject.ObjectName = lotNonActiveInfoEx.Lot; //COMPLOT inspectionObject.ItemName1 = lotNonActiveInfoEx.ComponentLot; //WOLOT inspectionObject.ItemName2 = lotNonActiveInfoEx.WorkOrderLot; //MATERIALLOT inspectionObject.ItemName3 = lotNonActiveInfoEx.MaterialLot; //OP1機台 inspectionObject.ItemName5 = lotNonActiveInfoEx.ProcessEquipment; inspectionObject.Quantity = 1; inspectionObject.Unit = lotNonActiveInfoEx.Unit; inspectionObject.InsertToDB(txnStamp.UserID, txnStamp.RecordTime); } #endregion }
protected void ttbBoxNo_TextChanged(object sender, EventArgs e) { try { // 清除資料與使用者介面 ClearField(); var convertInfo = WIPConvertInfoEx.GetWIPConvertInfoByTargetLot(ttbBoxNo.Text.Trim()); if (convertInfo == null) { throw new RuleCimesException(TextMessage.Error.T00030(lblUnPackingInventoryLot.Text, ttbBoxNo.Text.Trim()), ttbBoxNo); } // 取得批號 _ProcessLot = LotNonActiveInfo.GetLotNonActiveByLot(ttbBoxNo.Text.Trim()); // 若批號不存在拋錯 if (_ProcessLot == null) { throw new RuleCimesException(TextMessage.Error.T00045(lblUnPackingInventoryLot.Text), ttbBoxNo); } if (_ProcessLot.Status != "Finished") { // [01203]批號狀態不正確, 應為 {0} ! throw new RuleCimesException(TextMessage.Error.T01203("Finished"), ttbBoxNo); } if (_ProcessLot.OperationName != "入庫") { //[00361]批號({ 0})所在工作站({ 1}) 與({ 2}) 不同 ! throw new RuleCimesException(TextMessage.Error.T00361(_ProcessLot.Lot, _ProcessLot.OperationName, "入庫"), ttbBoxNo); } _ComponentList = ComponentNonactiveInfoEx.GetDataByInvBoxNo(_ProcessLot.Lot); // 資料繫結 gvComponent.SetDataSource(_ComponentList, true); } catch (Exception ex) { HandleError(ex); } }