Exemplo n.º 1
0
        /// <summary>
        /// 確認預約工作站是否有開啟物料檢查功能
        /// </summary>
        private void CheckBom(string opeartoinName, EquipmentInfo equipData, LotInfo lotData)
        {
            //確認工作站是否有開啟物料檢查功能,如果機台資料為NULL,則直接跳過這個檢查機制
            var operationData = OperationInfo.GetOperationByName(opeartoinName).ChangeTo <OperationInfoEx>();

            if (operationData.CheckBOM == "Y" && equipData != null)
            {
                #region 先比對BOM表的料是否都有上機
                //取得客製表[CST_WPC_BOM]工單對應華司料(SORTF = 2)的資料
                var WOBomList = CSTWPCWorkOrderBOMInfo.GetDataByWorkOrderAndSORTF(_LotData.WorkOrder, "2");

                //取得目前選定的機台上所有的物料資料
                var eqpMLotList = EquipmentMaterialLotInfo.GetEquipmentMaterialLotByEquipment(equipData.EquipmentName);

                //確認目前選定的機台是否已經有上物料
                WOBomList.ForEach(WOBom =>
                {
                    bool isFind = false;

                    foreach (var eqpMLot in eqpMLotList)
                    {
                        //取得料編號資料
                        var materialLotData = MaterialLotInfo.GetMaterialLotByMaterialLot(eqpMLot.MaterialLot);
                        if (WOBom.MATNR == materialLotData.MaterialNO)
                        {
                            //註記有找到對應的物料編號
                            isFind = true;
                            break;
                        }
                    }

                    if (isFind == false)
                    {
                        //機台:{0} 沒有上物料編號{1}的資料!
                        throw new Exception(RuleMessage.Error.C10145(equipData.EquipmentName, WOBom.MATNR));
                    }
                });

                #endregion

                #region 依照料號的孔位設定,確認孔位都有華司資料
                var deviceVersion = DeviceVersionInfo.GetLotCurrentDeviceVersion(lotData).ChangeTo <DeviceVersionInfoEx>();

                if (deviceVersion.PushLocation.ToString().IsNullOrEmpty())
                {
                    //[00031]{0}:{1}的系統屬性:{2} 未設定,請洽IT人員!
                    throw new CimesException(TextMessage.Error.T00031(GetUIResource("Device"), deviceVersion.DeviceName, "PUSH_LOCATION"));
                }
                var lstPushLocation = deviceVersion["PUSH_LOCATION"].ToString().Split(',');

                //先取得機台上的物料批資訊
                List <MaterialLotInfo> eqpMaterialLotList = new List <MaterialLotInfo>();
                eqpMLotList.ForEach(p =>
                {
                    var mLot = MaterialLotInfo.GetMaterialLotByMaterialLot(p.MaterialLot);
                    eqpMaterialLotList.Add(mLot);
                });

                for (int i = 0; i < lstPushLocation.Length; i++)
                {
                    var mlotData = eqpMaterialLotList.Find(p => p.Location == lstPushLocation[i]);
                    if (mlotData == null)
                    {
                        throw new CimesException(RuleMessage.Error.C00041(equipData.EquipmentName, lstPushLocation[i]));
                    }
                }
                #endregion
            }
        }
Exemplo n.º 2
0
        private DataTable GetLotTitle()
        {
            DataTable dt = _LotData.CopyDataToTable("MES_WIP_LOT");

            dt.Columns.Add("DeviceCode");//料號的2,3碼
            dt.Columns.Add("LotTypeDescr");
            dt.Columns.Add("WOQuantity");
            dt.Columns.Add("DeviceDescr");
            dt.Columns.Add("DeviceBPNo");
            dt.Columns.Add("DeviceBPRev");
            dt.Columns.Add("ProductionDate"); //預計生產日期
            dt.Columns.Add("ScheduleDate");   //預計完成日期
            dt.Columns.Add("BOM_MATNR");      //投入料號
            dt.Columns.Add("Device_PLMNO");   //PLM 編號
            dt.Columns.Add("Device_PLMVR");   //PLM 版本

            if (cbxWO.Checked)
            {
                var woLot = CSTWorkOrderLotInfo.GetWorkOrderLotDataByWorkOrderLot(ttbWOLot.Text.Trim());

                dt.Rows[0]["WOLOT"]       = woLot.WOLOT;
                dt.Rows[0]["INVLOT"]      = woLot.INVLOT;
                dt.Rows[0]["MATERIALLOT"] = woLot.MATERIALLOT;
                dt.Rows[0]["Quantity"]    = woLot.Quantity;
                dt.Rows[0]["LOT"]         = woLot.WOLOT;

                var cstWOBOMInfo = CSTWPCWorkOrderBOMInfo.GetDataByWorkOrder(woLot.WorkOrder).Find(p => p["SORTF"].ToString() == "1");
                if (cstWOBOMInfo != null)
                {
                    dt.Rows[0]["BOM_MATNR"] = cstWOBOMInfo["MATNR"].ToString();
                }

                dt.Rows[0]["DeviceCode"] = _LotData.DeviceName.Substring(1, 2);

                var lsLotType = WpcExClassItemInfo.GetExClassItemInfo("LotType", _LotData.LotType);
                dt.Rows[0]["LotTypeDescr"] = lsLotType.Count > 0 ? lsLotType[0].Remark02 : "";

                var WOData = WorkOrderInfo.GetWorkOrderByWorkOrder(woLot.WorkOrder);
                dt.Rows[0]["WOQuantity"]     = WOData.Quantity;
                dt.Rows[0]["ProductionDate"] = WOData["ProductionDate"].ToCimesString();
                dt.Rows[0]["ScheduleDate"]   = WOData.ScheduleDate;

                var DeviceData = DeviceVersionInfoEx.GetActiveDeviceVersion(_LotData.DeviceName).ChangeTo <DeviceVersionInfoEx>();
                dt.Rows[0]["DeviceDescr"]  = DeviceData.Description;
                dt.Rows[0]["DeviceBPNo"]   = DeviceData["BPNO"].ToString();
                dt.Rows[0]["DeviceBPRev"]  = DeviceData["BPREV"].ToString();
                dt.Rows[0]["Device_PLMVR"] = DeviceData["PLMVR"].ToString();
                dt.Rows[0]["Device_PLMNO"] = DeviceData["PLMNO"].ToString();
            }
            if (cbxSN.Checked || cbxLot.Checked)
            {
                dt.Rows[0]["WOLOT"]       = _LotData.WorkOrderLot;
                dt.Rows[0]["INVLOT"]      = _LotData.InventoryLot;
                dt.Rows[0]["MATERIALLOT"] = _LotData.MaterialLot;
                dt.Rows[0]["Quantity"]    = _LotData.Quantity;
                dt.Rows[0]["LOT"]         = _LotData.Lot;

                dt.Rows[0]["DeviceCode"] = _LotData.DeviceName.Substring(1, 2);
                var lsLotType = WpcExClassItemInfo.GetExClassItemInfo("LotType", _LotData.LotType);
                dt.Rows[0]["LotTypeDescr"] = lsLotType.Count > 0 ? lsLotType[0].Remark02 : "";

                var WOData = WorkOrderInfo.GetWorkOrderByWorkOrder(_LotData.WorkOrder);
                dt.Rows[0]["WOQuantity"]     = WOData.Quantity;
                dt.Rows[0]["ProductionDate"] = WOData["ProductionDate"].ToCimesString();
                dt.Rows[0]["ScheduleDate"]   = WOData.ScheduleDate;

                var DeviceData = DeviceVersionInfoEx.GetActiveDeviceVersion(_LotData.DeviceName).ChangeTo <DeviceVersionInfoEx>();
                dt.Rows[0]["DeviceDescr"]  = DeviceData.Description;
                dt.Rows[0]["DeviceBPNo"]   = DeviceData["BPNO"].ToString();
                dt.Rows[0]["DeviceBPRev"]  = DeviceData["BPREV"].ToString();
                dt.Rows[0]["Device_PLMVR"] = DeviceData["PLMVR"].ToString();
                dt.Rows[0]["Device_PLMNO"] = DeviceData["PLMNO"].ToString();

                var cstWOBOMInfo = CSTWPCWorkOrderBOMInfo.GetDataByWorkOrder(WOData.WorkOrder).Find(p => p["SORTF"].ToString() == "1");
                if (cstWOBOMInfo != null)
                {
                    dt.Rows[0]["BOM_MATNR"] = cstWOBOMInfo["MATNR"].ToString();
                }
            }

            return(dt);
        }