Exemple #1
0
 public void I_WorkOrder(WorkOrderInfo workOrderInfo, string code, string typecode)//新增随工单
 {
     SqlParameter[] para = new SqlParameter[11];
     para[0]        = new SqlParameter("@code", SqlDbType.Char, 1);
     para[0].Value  = code;
     para[1]        = new SqlParameter("@WO_Type", SqlDbType.VarChar, 20);
     para[1].Value  = workOrderInfo.WO_Type;
     para[2]        = new SqlParameter("@WO_ProType", SqlDbType.VarChar, 60);
     para[2].Value  = workOrderInfo.WO_ProType;
     para[3]        = new SqlParameter("@WO_Level", SqlDbType.VarChar, 20);
     para[3].Value  = workOrderInfo.WO_Level;
     para[4]        = new SqlParameter("@WO_ChipNum", SqlDbType.VarChar, 30);
     para[4].Value  = workOrderInfo.WO_ChipNum;
     para[5]        = new SqlParameter("@WO_PNum", SqlDbType.Int);
     para[5].Value  = workOrderInfo.WO_PNum;
     para[6]        = new SqlParameter("@WO_Note", SqlDbType.VarChar, 200);
     para[6].Value  = workOrderInfo.WO_Note;
     para[7]        = new SqlParameter("@WO_People", SqlDbType.VarChar, 20);
     para[7].Value  = workOrderInfo.WO_People;
     para[8]        = new SqlParameter("@WO_OrderNum", SqlDbType.VarChar, 30);
     para[8].Value  = workOrderInfo.WO_OrderNum;
     para[9]        = new SqlParameter("@SMSO_ID", SqlDbType.UniqueIdentifier);
     para[9].Value  = workOrderInfo.SMSO_ID;
     para[10]       = new SqlParameter("@typecode", SqlDbType.VarChar, 3);
     para[10].Value = typecode;
     SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionStringLocalTransaction, CommandType.StoredProcedure, "Proc_I_WorkOrder", para);
 }
Exemple #2
0
    public void WorkOrder_Edit(WorkOrderInfo workOrderInfo, Guid PT_ID)//编辑随工单
    {
        SqlParameter[] para = new SqlParameter[10];
        para[0]       = new SqlParameter("@WO_Time", SqlDbType.DateTime);
        para[0].Value = workOrderInfo.WO_Time;
        para[1]       = new SqlParameter("@WO_Note", SqlDbType.VarChar, 200);
        para[1].Value = workOrderInfo.WO_Note;
        para[2]       = new SqlParameter("@WO_People", SqlDbType.VarChar, 20);
        para[2].Value = workOrderInfo.WO_People;
        para[3]       = new SqlParameter("@WO_ProType", SqlDbType.VarChar, 60);
        para[3].Value = workOrderInfo.WO_ProType;
        para[4]       = new SqlParameter("@WO_Num", SqlDbType.VarChar, 30);
        para[4].Value = workOrderInfo.WO_Num;
        para[5]       = new SqlParameter("@WO_OrderNum", SqlDbType.VarChar, 30);
        para[5].Value = workOrderInfo.WO_OrderNum;
        para[6]       = new SqlParameter("@WO_SN", SqlDbType.VarChar, 30);
        para[6].Value = workOrderInfo.WO_SN;
        para[7]       = new SqlParameter("@WO_ID", SqlDbType.UniqueIdentifier);
        para[7].Value = workOrderInfo.WO_ID;
        para[8]       = new SqlParameter("@WO_PT_ID", SqlDbType.UniqueIdentifier);
        para[8].Value = PT_ID;
        para[9]       = new SqlParameter("@SMSO_ID", SqlDbType.UniqueIdentifier);
        para[9].Value = workOrderInfo.SMSO_ID;

        SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionStringLocalTransaction, CommandType.StoredProcedure, "Proc_U_WorkOrder_Edit", para);
    }
Exemple #3
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.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();

            var DeviceData = DeviceVersionInfoEx.GetActiveDeviceVersion(_LotData.DeviceName).ChangeTo <DeviceVersionInfoEx>();

            dt.Rows[0]["DeviceDescr"] = DeviceData.Description;
            dt.Rows[0]["DeviceBPNo"]  = "0 無欄位";
            dt.Rows[0]["DeviceBPRev"] = "0 無欄位";

            return(dt);
        }
Exemple #4
0
 public void I_WorkOrder_Devide_NEW(WorkOrderInfo workOrderInfo, Guid PT_ID, string sn, int num, Guid WOD_ID, int yuannum)//新增随工单
 {
     SqlParameter[] para = new SqlParameter[12];
     para[0]        = new SqlParameter("@WO_ID", SqlDbType.UniqueIdentifier);
     para[0].Value  = workOrderInfo.WO_ID;
     para[1]        = new SqlParameter("@SMSO_ID", SqlDbType.UniqueIdentifier);
     para[1].Value  = workOrderInfo.SMSO_ID;
     para[2]        = new SqlParameter("@WO_Num", SqlDbType.VarChar, 30);
     para[2].Value  = workOrderInfo.WO_Num;
     para[3]        = new SqlParameter("@WO_ProType", SqlDbType.VarChar, 60);
     para[3].Value  = workOrderInfo.WO_ProType;
     para[4]        = new SqlParameter("@WO_OrderNum", SqlDbType.VarChar, 30);
     para[4].Value  = workOrderInfo.WO_OrderNum;
     para[5]        = new SqlParameter("@WO_SN", SqlDbType.VarChar, 30);
     para[5].Value  = sn;
     para[6]        = new SqlParameter("@WO_People", SqlDbType.VarChar, 20);
     para[6].Value  = workOrderInfo.WO_People;
     para[7]        = new SqlParameter("@WO_PT_ID", SqlDbType.UniqueIdentifier);
     para[7].Value  = PT_ID;
     para[8]        = new SqlParameter("@num", SqlDbType.Int);
     para[8].Value  = num;
     para[9]        = new SqlParameter("@WO_Note", SqlDbType.VarChar, 200);
     para[9].Value  = workOrderInfo.WO_Note;
     para[10]       = new SqlParameter("@WOD_ID", SqlDbType.UniqueIdentifier);
     para[10].Value = WOD_ID;
     para[11]       = new SqlParameter("@yuannum", SqlDbType.Int);
     para[11].Value = yuannum;
     SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionStringLocalTransaction, CommandType.StoredProcedure, "Proc_I_WorkOrder_Devide_NEW", para);
 }
        internal static void GetWorkOrderInfo(WorkOrderInfo workOrderInfo)
        {
            SqlConnection connection = null;

            try
            {
                var sp = "up_PartNumberFromWorkOrder";
                connection = VjsConnection();
                SqlCommand command = CreateCommand(connection, sp);
                command.Parameters.Add(new SqlParameter("@WorkId", workOrderInfo.WorkId));

                using (SqlDataReader reader = command.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        workOrderInfo.PartNumber = reader["PartNumber"] as string;
                        workOrderInfo.Revision   = reader["Revision"] as string;
                    }
                }

                command.Dispose();
            }
            catch (Exception ex)
            {
                _log.ErrorFormat(ex.ToString());
            }
            finally
            {
                CloseConnection(connection);
            }
        }
Exemple #6
0
        private void ConfirmTestInfo()
        {
            try
            {
                if (PassedValidation())
                {
                    // finish up initializing the TestSession
                    BenchOperator currentOperator = new BenchOperator(ClockNumber);
                    currentOperator.GetName();
                    MainWindow_VM.Instance.TestSession.BenchOperator = currentOperator;
                    MainWindow_VM.Instance.TestSession.WorkId        = WorkOrder;

                    if (MainWindow_VM.Instance.TestSession.TestTemplate.Id == (int)TestType.TorsionTestToFailure)
                    {
                        MainWindow_VM.Instance.CurrentViewModel = MainWindow_VM.Instance.UnidirectionalToFailureTestVm;
                        var vm = (UnidirectionalTorqueTest_VM)MainWindow_VM.Instance.CurrentViewModel;

                        // starts up the test monitoring.
                        vm.PrepareToTest(MainWindow_VM.Instance.TestSession);
                    }
                    else if (MainWindow_VM.Instance.TestSession.TestTemplate.Id == (int)TestType.SteeringShaftTest_4000_inlbs)
                    {
                        // if this is a brand new part number with no calibration information, this shaft will need to be calibrated.
                        WorkOrderInfo woInfo = new WorkOrderInfo(WorkOrder);
                        woInfo.Load();

                        if (HasBeenCalibrated(woInfo.PartNumber, woInfo.Revision))
                        {
                            MainWindow_VM.Instance.CurrentViewModel = MainWindow_VM.Instance.SteeringShaftTestVm;
                            var vm = (FullyReversedTorqueTest_VM)MainWindow_VM.Instance.CurrentViewModel;

                            // starts up the test monitoring.
                            vm.PrepareToTest(MainWindow_VM.Instance.TestSession);
                        }
                        else
                        {
                            MainWindow_VM.Instance.CalibrationVm.PartNumber = woInfo.PartNumber;
                            MainWindow_VM.Instance.CalibrationVm.Revision   = woInfo.Revision;

                            MainWindow_VM.Instance.CurrentViewModel = MainWindow_VM.Instance.CalibrationVm;
                        }
                    }
                    else
                    {
                        throw new Exception("Invalid test type, must select a valid test type to continue.");
                    }
                }
            }
            catch (Exception ex)
            {
                _log.Error(ex.ToString());
                ErrorMessage = ex.Message;
            }
        }
        protected void btnSubmitAddresses_Click(object sender, EventArgs e)
        {
            AdminController aCont = new AdminController();
            WorkOrderInfo   wo    = aCont.Get_WorkOrderById(Convert.ToInt32(Request.QueryString["woid"]));

            foreach (WOGroupInfo group in wo.Groups)
            {
                foreach (WOGroupStationInfo groupStation in group.WOGroupStations)
                {
                    TextBox txtStreet1 = (TextBox)pnlAddresses.FindControl("txtStreet1_" + group.Id.ToString() + "_" + groupStation.Id.ToString());
                    if (txtStreet1 != null)
                    {
                        groupStation.Station.Address1 = txtStreet1.Text;
                    }
                    TextBox txtStreet2 = (TextBox)pnlAddresses.FindControl("txtStreet2_" + group.Id.ToString() + "_" + groupStation.Id.ToString());
                    if (txtStreet2 != null)
                    {
                        groupStation.Station.Address2 = txtStreet2.Text;
                    }
                    TextBox txtCity = (TextBox)pnlAddresses.FindControl("txtCity_" + group.Id.ToString() + "_" + groupStation.Id.ToString());
                    if (txtCity != null)
                    {
                        groupStation.Station.City = txtCity.Text;
                    }
                    TextBox txtState = (TextBox)pnlAddresses.FindControl("txtState_" + group.Id.ToString() + "_" + groupStation.Id.ToString());
                    if (txtState != null)
                    {
                        groupStation.Station.State = txtState.Text;
                    }
                    TextBox txtZip = (TextBox)pnlAddresses.FindControl("txtZip_" + group.Id.ToString() + "_" + groupStation.Id.ToString());
                    if (txtZip != null)
                    {
                        groupStation.Station.Zip = txtZip.Text;
                    }
                    TextBox txtAttentionLine = (TextBox)pnlAddresses.FindControl("txtAttentionLine_" + group.Id.ToString() + "_" + groupStation.Id.ToString());
                    if (txtAttentionLine != null)
                    {
                        groupStation.Station.AttentionLine = txtAttentionLine.Text;
                    }
                    TextBox txtPhone = (TextBox)pnlAddresses.FindControl("txtPhone_" + group.Id.ToString() + "_" + groupStation.Id.ToString());
                    if (txtPhone != null)
                    {
                        groupStation.Station.Phone = txtPhone.Text;
                    }
                }
            }
            lblMessage.Text += aCont.createEasySpotOrder(wo.Groups);
            if (lblMessage.Text.IndexOf("Error:") == -1)
            {
                Response.Redirect("/Work-Orders.aspx?woid=" + wo.Id.ToString());
            }
        }
Exemple #8
0
 private void comboBox3_SelectionChangeCommitted(object sender, EventArgs e)
 {
     if (this.comboBox3.SelectedValue != null && this.comboBox3.SelectedValue.ToString().Trim() != "")
     {
         List <WorkOrderInfo> workOrders = (List <WorkOrderInfo>) this.comboBox3.DataSource;
         WorkOrderInfo        workOrder  = workOrders[this.comboBox3.SelectedIndex];
         this.textBox6.Text  = workOrder.CustName;
         this.textBox7.Text  = workOrder.CustId;
         this.textBox17.Text = workOrder.SoOrder;
         this.textBox13.Text = workOrder.OrderQty;
         loadResources(workOrder.CustId, workOrder.ItemCode, "1", workOrder.WorkNo, workOrder.CustPO);         //加载打印资源,并计算可打印数量
     }
 }
Exemple #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //增加“任务列表--工单记录”审核 和 处理功能验证逻辑
                int           userId   = BLL.Util.GetLoginUserID();
                WorkOrderInfo modelout = null;
                if (!string.IsNullOrEmpty(OrderID))
                {
                    modelout = BLL.WorkOrderInfo.Instance.GetWorkOrderInfo(OrderID);
                }
                if (BLL.Util.CheckRight(userId, "SYS024BUG100601") || BLL.Util.CheckRight(userId, "SYS024BUG100602") || (modelout != null && modelout.ReceiverID == userId) || Requester == "intelligentplatform")
                {
                    //BitAuto.YanFa.SysRightManager.Common.UserInfo.Check();
                    CheckProcessRight();
                    OperInfoControl2.OrderID  = OperInfoControl1.OrderID = OrderID;
                    OperInfoControl2.ViewType = 2;
                    OperInfoControl1.ViewType = 1;
                    // Entities.WorkOrderInfo model = BLL.WorkOrderInfo.Instance.GetWorkOrderInfo(OrderID);

                    bindData();

                    CustSalesControl1.crmCustID = crmCustID;

                    ccUserID = BLL.WorkOrderInfo.Instance.GetCustIDByWorkOrderTel(modelout);

                    if (!string.IsNullOrEmpty(OrderID) && BLL.WorkOrderInfo.Instance.HasConversation(OrderID))
                    {
                        string imurl      = ConfigurationManager.AppSettings["DealerIMURL"].ToString();
                        int    thisuserid = BLL.Util.GetLoginUserID();
                        CHUrl = "<a href='javascript:void(0)' onclick=\"GotoConversation(this,'" + imurl + "/ConversationHistoryForCC.aspx','" + thisuserid + "','','" + OrderID + "')\">关联对话</a>";
                    }

                    if (ccUserID != string.Empty)
                    {
                        viewCCUserUrl = "<span><a target='_blank' href='/TaskManager/CustInformation.aspx?CustID=" + ccUserID + "' style='font-size:12px;'>查看用户</a></span>";
                        Entities.CustBasicInfo model = new Entities.CustBasicInfo();
                        model      = BLL.CustBasicInfo.Instance.GetCustBasicInfo(ccUserID);
                        ccCustName = model.CustName;
                    }
                }
                else
                {
                    Response.Write("您没有访问该页面的权限");
                    Response.End();
                }
            }
        }
Exemple #10
0
        /// <summary>
        /// 檢查傳入機台是否符合工單上線別內可使用機台名稱
        /// </summary>
        /// <param name="equipmentName"></param>
        /// <param name="lotData"></param>
        /// <returns></returns>
        public static bool CheckEqpGruopAndDivision(string equipmentName, LotInfo lot)
        {
            bool checkResult = false;

            //找出工單上的線別(division),再用線別名稱去工作站的機台設定,找出同名稱的機台群組,再比照機台的正確性

            //取得批號目前的工作站資料
            var operationData = OperationInfo.GetOperationByName(lot.OperationName);

            if (operationData == null)
            {
                //機台:{0},不在可用機台範圍,請至 [工作站設定] 確認機台設定
                throw new Exception(RuleMessage.Error.C10005(equipmentName));
            }

            //依據批號工作站找出歸屬的機台群組清單
            List <OperationResourceInfoEx> resourceDataList = OperationResourceInfoEx.GetDataByOperSID(operationData.OperationSID);

            if (resourceDataList.Count == 0)
            {
                //機台:{0},不在可用機台範圍,請至 [工作站設定] 確認機台設定
                throw new Exception(RuleMessage.Error.C10005(equipmentName));
            }

            foreach (var resourceData in resourceDataList)
            {
                //找出同名稱的機台群組
                var equipGroupData = EquipmentGroupInfo.GetEquipmentGroupByID(resourceData.ResourceID);

                //找出工單上的線別(Division)
                var workOrder = WorkOrderInfo.GetWorkOrderByWorkOrder(lot.WorkOrder).ChangeTo <WorkOrderInfoEx>();

                if (equipGroupData.GroupName == workOrder.Division)
                {
                    //用群組SID找出在該群組下的工作站
                    List <EquipGroupEquipInfoEx> eqGroupDataList = EquipGroupEquipInfoEx.GetEquipGroupByGroupSID(equipGroupData.ID);
                    if (eqGroupDataList.Find(p => p.EquipmentName == equipmentName) != null)
                    {
                        checkResult = true;
                    }
                }
            }

            return(checkResult);
        }
Exemple #11
0
 //建立认证随工单
 public void I_WorkOrder_NEW(WorkOrderInfo workOrderInfo, string code, string typecode, Guid PT_ID, string WO_PrintWord, string WO_QiaoKe, string WO_YingJiao, int WO_FirstDay, string WO_PT_Code, string WO_PT_ChipType, string sn, int oem, Guid InID)    //新增随工单
 {
     SqlParameter[] para = new SqlParameter[19];
     para[0]        = new SqlParameter("@code", SqlDbType.Char, 1);
     para[0].Value  = code;
     para[1]        = new SqlParameter("@WO_Type", SqlDbType.VarChar, 20);
     para[1].Value  = workOrderInfo.WO_Type;
     para[2]        = new SqlParameter("@WO_ProType", SqlDbType.VarChar, 60);
     para[2].Value  = workOrderInfo.WO_ProType;
     para[3]        = new SqlParameter("@WO_PNum", SqlDbType.Int);
     para[3].Value  = workOrderInfo.WO_PNum;
     para[4]        = new SqlParameter("@WO_Note", SqlDbType.VarChar, 200);
     para[4].Value  = workOrderInfo.WO_Note;
     para[5]        = new SqlParameter("@WO_People", SqlDbType.VarChar, 20);
     para[5].Value  = workOrderInfo.WO_People;
     para[6]        = new SqlParameter("@WO_OrderNum", SqlDbType.VarChar, 30);
     para[6].Value  = workOrderInfo.WO_OrderNum;
     para[7]        = new SqlParameter("@SMSO_ID", SqlDbType.UniqueIdentifier);
     para[7].Value  = workOrderInfo.SMSO_ID;
     para[8]        = new SqlParameter("@typecode", SqlDbType.VarChar, 4);
     para[8].Value  = typecode;
     para[9]        = new SqlParameter("@PT_ID", SqlDbType.UniqueIdentifier);
     para[9].Value  = PT_ID;
     para[10]       = new SqlParameter("@WO_PrintWord", SqlDbType.VarChar, 2);
     para[10].Value = WO_PrintWord;
     para[11]       = new SqlParameter("@WO_QiaoKe", SqlDbType.Char, 1);
     para[11].Value = WO_QiaoKe;
     para[12]       = new SqlParameter("@WO_YingJiao", SqlDbType.Char, 2);
     para[12].Value = WO_YingJiao;
     para[13]       = new SqlParameter("@WO_FirstDay", SqlDbType.Int);
     para[13].Value = WO_FirstDay;
     para[14]       = new SqlParameter("@WO_PT_Code", SqlDbType.VarChar, 2000);
     para[14].Value = WO_PT_Code;
     para[15]       = new SqlParameter("@WO_PT_ChipType", SqlDbType.VarChar, 6);
     para[15].Value = WO_PT_ChipType;
     para[16]       = new SqlParameter("@WO_SN", SqlDbType.VarChar, 30);
     para[16].Value = sn;
     para[17]       = new SqlParameter("@OEM", SqlDbType.Int);
     para[17].Value = oem;
     para[18]       = new SqlParameter("@InStoreDetailID", SqlDbType.UniqueIdentifier);
     para[18].Value = InID;
     SqlHelper.ExecuteNonQuery(SqlHelper.ConnectionStringLocalTransaction, CommandType.StoredProcedure, "Proc_I_WorkOrder_NEW_IQC", para);
 }
Exemple #12
0
        public static MaterialWorkOrderViewModel SaveWorkOrder(WorkOrderInfo model, UserLoginInfo loginUser)
        {
            var result = new MaterialWorkOrderViewModel()
            {
                IsSuccess = true
            };

            try
            {
                //add
                if (model.Id == 0)
                {
                    model.WIIsValid         = 1;
                    model.WICreateUserNo    = loginUser.JobNum;
                    model.WICreateUserName  = loginUser.UserName;
                    model.WICreateTime      = DateTime.Now;
                    model.WIOperateUserNo   = loginUser.JobNum;
                    model.WIOperateUserName = loginUser.UserName;
                    model.WIOperateTime     = DateTime.Now;
                    model.Id       = _materialDal.InsertWorkOrder(model);
                    result.Message = EncryptHelper.DesEncrypt(model.Id.ToString()); //TODO
                    result.data    = model;
                }
                else
                {
                    //Update
                    model.WIOperateUserNo   = loginUser.JobNum;
                    model.WIOperateUserName = loginUser.UserName;
                    model.WIOperateTime     = DateTime.Now;
                    _materialDal.UpdateWorkOrder(model);
                    result.Message = EncryptHelper.DesEncrypt(model.Id.ToString()); //TODO
                    result.data    = model;
                }
            }
            catch (Exception ex)
            {
                result.IsSuccess = false;
                result.Message   = ex.Message;
            }
            return(result);
        }
 private void comboBox1_SelectionChangeCommitted(object sender, EventArgs e)
 {
     if (this.comboBox1.SelectedValue != null && this.comboBox1.SelectedValue.ToString().Trim() != "")
     {
         List <WorkOrderInfo> workOrders = (List <WorkOrderInfo>) this.comboBox1.DataSource;
         WorkOrderInfo        workOrder  = workOrders[this.comboBox1.SelectedIndex];
         this.textBox10.Text = workOrder.CustName;
         this.textBox11.Text = workOrder.CustId;
         this.textBox17.Text = workOrder.SoOrder;
         this.textBox18.Text = workOrder.CusItemNum;
         this.textBox2.Text  = workOrder.OrderQty;
         this.textBox8.Text  = ctCodeService.getGeneratedCTCountByPO(workOrder.WorkNo, workOrder.CustPO);      //工單、客戶PO已產生CT數量,  隨客戶PO改變
         ctCodeInfo.Cusname  = workOrder.CustName;
         ctCodeInfo.Cusno    = workOrder.CustId;
         ctCodeInfo.SoOrder  = workOrder.SoOrder;
         ctCodeInfo.Cusmatno = workOrder.CusItemNum;
         ctCodeInfo.Orderqty = workOrder.OrderQty;
         ctCodeInfo.Cuspo    = workOrder.CustPO;
         loadResources(workOrder.CustId, workOrder.ItemCode, "0", workOrder.WorkNo, workOrder.CustPO);         //加载打印资源,并计算可打印数量
     }
 }
        public bool CannotAcceptResults(TorqueTest test, string workId, out string result)
        {
            // look up part number and revision
            WorkOrderInfo partInWorkOrder = new WorkOrderInfo(workId);

            partInWorkOrder.Load();

            // load a previous calibration
            _savedCalibration = new Calibration(partInWorkOrder.PartNumber, partInWorkOrder.Revision);
            _savedCalibration.Load();
            if (_savedCalibration.NominalCwDeflection == null)
            {
                result = Messages.MissingCalibrationDataError();
                return(false);
            }

            // now create a comparison calibration based off the test results
            Calibration comparison = new Calibration(partInWorkOrder.PartNumber, partInWorkOrder.Revision);

            comparison.CalculateCalibrationValues(test.CopyOfData, test.MaxTorque, test.MinTorque);

            // clockwise
            var expectedAngleCw = (decimal)_savedCalibration.NominalCwDeflection;
            var actualAngleCw   = (decimal)comparison.NominalCwDeflection;
            var percentDiffCw   = PercentDifference(expectedAngleCw, actualAngleCw);

            // counterclockwise
            var expectedAngleCcw = (decimal)_savedCalibration.NominalCcwDeflection;
            var actualAngleCcw   = (decimal)comparison.NominalCcwDeflection;
            var percentDiffCcw   = PercentDifference(expectedAngleCcw, actualAngleCcw);

            // compare the calibration results.
            if (percentDiffCw < ALLOWABLE_PCT_DIFF && percentDiffCcw < ALLOWABLE_PCT_DIFF)
            {
                result = Messages.TestPassedMessage(percentDiffCw, percentDiffCcw, ALLOWABLE_PCT_DIFF);
                return(false); // false means pass (CAN accept results)
            }
            result = Messages.TestFailureMessage(percentDiffCw, percentDiffCcw, ALLOWABLE_PCT_DIFF);
            return(true); // true means fail (Cannot Accept Results)
        }
Exemple #15
0
        /// <summary>
        /// 通過工單號獲取信息
        /// </summary>
        /// <param name="workno"></param>
        /// <returns></returns>
        public List <WorkOrderInfo> getWorkNoInofo(string workno)
        {
            //385  572 CIN:833
            List <WorkOrderInfo> workOrders = null;
            StringBuilder        strSql     = new StringBuilder();

            strSql.Append("SELECT MWORK.ORGANIZATION_ID,MWORK.CUSTOMER_ITEM_NUMBER,MWORK.WIP_ENTITY_NAME,MWORK.START_QUANTITY,MWORK.QUANTITY_COMPLETED,MWORK.SO_ORDER,MWORK.ITEM_CODE,MWORK.ITEM_DESC,MWORK.CUST_PO_NUMBER,MWORK.CUSTOMER_ID,MWORK.CUST_NAME,MWORK.ORDER_QTY FROM MES_WORKINFO_V  MWORK WHERE MWORK.WIP_ENTITY_NAME =:workno");
            OracleParameter[] parameters =
            {
                new OracleParameter(":workno", OracleDbType.Varchar2, 900)
            };
            parameters[0].Value = workno;
            DataSet ds = OracleSQLHelper.ExecuteDataset(OracleSQLHelper.ConnectionString, CommandType.Text, strSql.ToString(), parameters);

            if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0)
            {
                workOrders = new List <WorkOrderInfo>();
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    WorkOrderInfo workOrderInfo = new WorkOrderInfo();
                    workOrderInfo.OrgId        = dr["ORGANIZATION_ID"].ToString();
                    workOrderInfo.CusItemNum   = dr["CUSTOMER_ITEM_NUMBER"].ToString();
                    workOrderInfo.WorkNo       = dr["WIP_ENTITY_NAME"].ToString();
                    workOrderInfo.StartQty     = dr["START_QUANTITY"].ToString();
                    workOrderInfo.CompletedQty = dr["QUANTITY_COMPLETED"].ToString();
                    workOrderInfo.SoOrder      = dr["SO_ORDER"].ToString();
                    workOrderInfo.ItemCode     = dr["ITEM_CODE"].ToString();
                    workOrderInfo.ItemDesc     = dr["ITEM_DESC"].ToString();
                    workOrderInfo.CustPO       = dr["CUST_PO_NUMBER"].ToString();
                    workOrderInfo.CustId       = dr["CUSTOMER_ID"].ToString();
                    workOrderInfo.CustName     = dr["CUST_NAME"].ToString();
                    workOrderInfo.OrderQty     = dr["ORDER_QTY"].ToString();
                    workOrders.Add(workOrderInfo);
                }
            }
            return(workOrders);
        }
Exemple #16
0
 public static Domain.WorkOrderInfoDomain ToDomainWOModel(this WorkOrderInfo entity)
 {
     if (entity.LineNumber == null)
     {
         entity.LineNumber = 0;
     }
     if (entity == null)
     {
         return(null);
     }
     return(new Domain.WorkOrderInfoDomain
     {
         WOID = entity.WOID,
         CreatedBy = entity.CreatedBy,
         PONumber = entity.PONumber,
         PartNum = entity.PartNum,
         FGDimension = entity.FGDimension,
         Description = entity.Description,
         Remark = entity.Remark,
         CommittedDeliveryDate = entity.CommittedDeliveryDate.HasValue ? entity.CommittedDeliveryDate.Value : new DateTime(),
         RequestedDeliveryDate = entity.RequestedDeliveryDate,
         LineNumber = (int)entity.LineNumber
     });
 }
 public abstract void Update_WorkOrder(WorkOrderInfo WorkOrder);
 public abstract int Add_WorkOrder(WorkOrderInfo WorkOrder);
Exemple #19
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);
        }
Exemple #20
0
        protected void Page_Load(object sender, EventArgs e)
        {
            AdminController aCont = new AdminController();

            if (Tasks.Count() > 0)
            {
                lblWOId.Text           = Tasks[0].WorkOrderId.ToString();
                lblCompletionDate.Text = Tasks[0].DeliveryOrderDateComplete.ToShortDateString();
                if (Tasks[0].CreatedById != -1)
                {
                    UserInfo user = UserController.GetUserById(PortalId, Convert.ToInt32(Tasks[0].CreatedById));
                    lblOrderUser.Text = user.DisplayName;
                }
                lblDeliveryMethod.Text = Tasks[0].DeliveryMethod;
                WorkOrderInfo  wo     = aCont.Get_WorkOrderById(Tasks[0].WorkOrderId);
                AdvertiserInfo billTo = new AdvertiserInfo();
                if (wo.BillToId != -1)
                {
                    billTo = aCont.Get_AdvertiserById(wo.BillToId);
                }
                else
                {
                    billTo = aCont.Get_AdvertiserById(wo.AdvertiserId);
                }
                litBillTo.Text  = billTo.AdvertiserName + "<br />";
                litBillTo.Text += billTo.Address1 + "<br />";
                if (billTo.Address2 != "")
                {
                    litBillTo.Text += billTo.Address2 + "<br />";
                }
                litBillTo.Text += billTo.City + ", " + billTo.State + " " + billTo.Zip + "<br />";
                WOGroupStationInfo wogroupStation = aCont.Get_WorkOrderGroupStationById(Tasks[0].StationId);
                StationInfo        station        = aCont.Get_StationById(wogroupStation.StationId);
                litShipTo.Text  = station.StationName + "<br />";
                litShipTo.Text += station.CallLetter + "<br />";
                litShipTo.Text += station.Address1 + "<br />";
                if (station.Address2 != "")
                {
                    litShipTo.Text += station.Address2 + "<br />";
                }
                if (station.Phone != "")
                {
                    litShipTo.Text += "Tel: " + station.Phone + "<br />";
                }
                if (station.Fax != "")
                {
                    litShipTo.Text += "Fax: " + station.Fax + "<br />";
                }
                if (station.Email != "")
                {
                    litShipTo.Text += "Email: " + station.Email + "<br />";
                }
                if (station.AttentionLine != "")
                {
                    litShipTo.Text += "ATTENTION: " + station.AttentionLine + "<br />";
                }

                litShipTo.Text += station.City + ", " + station.State + " " + station.Zip + "<br />";
                plTasks.Controls.Clear();
                foreach (TaskInfo Task in Tasks)
                {
                    LibraryItemInfo lib = aCont.Get_LibraryItemById(Task.LibraryId);
                    Literal         lit = new Literal();
                    lit.Text = "<div class=\"pmtRow\"><div class=\"pmtCell2 outline\">" + Task.Quantity.ToString() + "</div>";
                    string desc = "";
                    try {
                        desc = Task.Description.Substring(Task.Description.IndexOf("Station:"), (Task.Description.IndexOf(", Delivery Method")) - Task.Description.IndexOf("Station:"));
                    }
                    catch { }
                    lit.Text += "<div class=\"pmtCell2 outline\">" + lib.Title + "</div>";
                    lit.Text += "<div class=\"pmtCell2 outline\">" + lib.ProductDescription + "</div>";
                    lit.Text += "<div class=\"pmtCell2 outline\">" + Task.DeliveryMethod + "</div>";
                    lit.Text += "<div class=\"pmtCell2 outline\">" + lib.MediaType.ToUpper() + "</div>";
                    lit.Text += "<div class=\"pmtCell2 outline\">" + lib.Standard + "</div>";
                    lit.Text += "<div class=\"pmtCell2 outline\">" + lib.MediaLength + "</div></div>";
                    plTasks.Controls.Add(lit);
                }
            }
        }
Exemple #21
0
        public ActionResult ImportWorkOrder(int type)
        {
            var result = new ResultInfoModel()
            {
                IsSuccess = false
            };
            StringBuilder      strbuild = new StringBuilder();
            string             FileName;
            string             savePath;
            HttpPostedFileBase file = Request.Files["file"];

            if (file == null || file.ContentLength <= 0)
            {
                result.Message = "please choose file";
                return(Content(JsonHelper.JsonSerializer(result)));
            }
            else
            {
                string fileName   = Path.GetFileName(file.FileName);
                int    filesize   = file.ContentLength;                         //获取上传文件的大小单位为字节byte
                string fileEx     = Path.GetExtension(fileName);                //获取上传文件的扩展名
                string NoFileName = Path.GetFileNameWithoutExtension(fileName); //获取无扩展名的文件名
                int    Maxsize    = 4000 * 1024;                                //定义上传文件的最大空间大小为4M
                string FileType   = ".xls,.xlsx";                               //定义上传文件的类型字符串

                FileName = NoFileName + fileEx;
                if (!FileType.Contains(fileEx))
                {
                    result.Message = "please upload .xls and .xlsx";
                    return(Content(JsonHelper.JsonSerializer(result)));
                }
                if (filesize >= Maxsize)
                {
                    result.Message = string.Format("file size can't big than {0}", Maxsize);
                    return(Content(JsonHelper.JsonSerializer(result)));
                }
                string path = Server.MapPath("~/App_Data/uploads");
                savePath = Path.Combine(path, FileName);
                file.SaveAs(savePath);


                string strConn;
                strConn = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + savePath + ";Extended Properties=Excel 12.0;";
                using (OleDbConnection conn = new OleDbConnection(strConn))
                {
                    conn.Open();
                    OleDbDataAdapter myCommand = new OleDbDataAdapter("select * from [Sheet1$]", strConn);
                    DataSet          myDataSet = new DataSet();
                    try
                    {
                        myCommand.Fill(myDataSet, "ExcelInfo");
                    }
                    catch (Exception ex)
                    {
                        result.Message = ex.Message;
                        return(Content(JsonHelper.JsonSerializer(result)));
                    }
                    DataTable table = myDataSet.Tables["ExcelInfo"].DefaultView.ToTable();
                    try
                    {
                        for (int i = 0; i < table.Rows.Count; i++)
                        {
                            WorkOrderInfo model = new WorkOrderInfo();
                            model.WIWorkOrder             = table.Rows[i][0].ToString();
                            model.WISapPN                 = table.Rows[i][1].ToString();
                            model.WIProductName           = table.Rows[i][2].ToString();
                            model.WIReceiptTime           = table.Rows[i][3].ToString();
                            model.WIReceiptBy             = table.Rows[i][4].ToString();
                            model.WICloseDateShift        = table.Rows[i][5].ToString();
                            model.WIOrderArchived         = table.Rows[i][6].ToString();
                            model.WIParameterRecord       = table.Rows[i][7].ToString();
                            model.WIToolMaintenanceRecord = table.Rows[i][8].ToString();
                            model.WIToolMachineCheck      = table.Rows[i][9].ToString();
                            model.WIQuantityConfirm       = table.Rows[i][10].ToString();
                            model.WIArchivedBy            = table.Rows[i][11].ToString();
                            model.WIWeeklyCheck           = table.Rows[i][12].ToString();
                            model.WIRemarks               = table.Rows[i][7].ToString();
                            model.WIGetBy                 = table.Rows[i][8].ToString();
                            model.WIGetTime               = table.Rows[i][9].ToString();
                            model.WIType = type;
                            MaterialBusiness.SaveWorkOrder(model, this.LoginUser);
                        }
                        result.IsSuccess = true;
                    }
                    catch (Exception ex)
                    {
                        result.Message = ex.Message;
                        return(Content(JsonHelper.JsonSerializer(result)));
                    }
                    conn.Close();
                }
                return(Content(JsonHelper.JsonSerializer(result)));
            }
        }
Exemple #22
0
        public string buildRequest(string ticket)
        {
            string req = "";

            string[] custCodes = new string[6] {
                "CUSTOMIZATION 30 MIN", "HD CUSTOMIZATION 30 MIN", "SPOT CUSTOMIZATION", "HD CUSTOMIZATION SPOT", "CUSTOMIZATION 5 MIN", "HD CUSTOMIZATION 5 MIN"
            };
            int custIndex = 2;

            int                i         = 1;
            string             xmlString = "";
            List <InvoiceInfo> invs      = aCont.Get_InvoicesByToSend();

            if (invs.Count > 0)
            {
                xmlString += "<?xml version=\"1.0\" encoding=\"utf-8\"?><?qbxml version=\"6.0\"?><QBXML><QBXMLMsgsRq onError=\"stopOnError\">";
                //build array of xml
                foreach (InvoiceInfo inv in invs)
                {
                    xmlString += "<InvoiceAddRq requestID=\"" + inv.Id.ToString() + "\"><InvoiceAdd>";//
                    List <int> woIds = aCont.Get_WOInsByInvoiceId(inv.Id);
                    if (woIds.Count > 0 && woIds[0] > 0)
                    {
                        WorkOrderInfo  wo1    = aCont.Get_WorkOrderById(woIds[0]);
                        AdvertiserInfo billto = aCont.Get_AdvertiserById(wo1.BillToId);
                        if (billto.Id == -1)
                        {
                            billto = aCont.Get_AdvertiserById(wo1.AdvertiserId);
                        }
                        i++;
                        xmlString += "<CustomerRef><FullName>" + billto.AdvertiserName.Trim().Replace("&", "&#038;") + "</FullName></CustomerRef>";
                        xmlString += "<BillAddress><Addr1>" + billto.AdvertiserName.Trim().Replace("&", "&#038;") + "</Addr1><Addr2>" + billto.Address1.Trim().Replace("&", "&#038;");
                        if (billto.Address2.Trim() != "")
                        {
                            xmlString += " - " + billto.Address2.Trim().Replace("&", "&#038;");
                        }
                        xmlString += "</Addr2><City>" + billto.City.Trim().Replace("&", "&#038;") + "</City><State>" + billto.State.Trim().Replace("&", "&#038;") + "</State><PostalCode>" + billto.Zip.Trim().Replace("&", "&#038;") + "</PostalCode><Country>" + billto.Country.Trim().Replace("&", "&#038;") + "</Country></BillAddress>";
                        string po = wo1.PONumber;
                        if (po == "")
                        {
                            try
                            {
                                po = wo1.Groups[0].LibraryItems[0].PMTMediaId.Replace("&", "&#038;");
                            }
                            catch { }
                        }
                        xmlString += "<PONumber>" + po.Replace("&", "&#038;") + "</PONumber>";
                        if (woIds.Count == 1)
                        {
                            xmlString += "<FOB>WO: " + woIds[0].ToString() + "</FOB>";
                        }
                        else if (woIds.Count > 1)
                        {
                            xmlString += "<FOB>SEE BELOW</FOB>";
                        }
                        xmlString += "<Memo>" + inv.Id.ToString() + "</Memo>";
                        AgencyInfo ag = aCont.Get_AgencyById(wo1.AgencyId);
                        xmlString += "<Other>" + ag.AgencyName.Trim().Replace("&", "&#038;") + "</Other>";
                        foreach (int woId in woIds)
                        {
                            WorkOrderInfo   wo       = aCont.Get_WorkOrderById(woId);
                            List <TaskInfo> tasks    = aCont.Get_TasksByWOId(wo.Id);
                            int             groupId  = -1;
                            bool            groupNew = true;
                            for (int j = 0; j < tasks.Count; j++)
                            {
                                TaskInfo task = tasks[j];
                                if (groupId == -1)
                                {
                                    groupId = task.WOGroupId;
                                }
                                if (task.WOGroupId != groupId)
                                {
                                    groupNew = true;
                                    groupId  = task.WOGroupId;
                                }
                                if (task.DeliveryStatus.ToLower() != "cancelled" && !task.isDeleted)
                                {
                                    if (task.TaskType != GroupTypeEnum.Delivery)
                                    {
                                        WOGroupInfo       group     = aCont.Get_WorkOrderGroupById(task.WOGroupId);
                                        List <QBCodeInfo> servCodes = aCont.FindQBCodesByTask(task.Id, 0, true);
                                        LibraryItemInfo   lib       = aCont.Get_LibraryItemById(task.LibraryId);
                                        MasterItemInfo    master    = new MasterItemInfo();
                                        if (task.TaskType == GroupTypeEnum.Non_Deliverable)
                                        {
                                            master = aCont.Get_MasterItemById(task.MasterId);
                                        }
                                        //foreach (ServiceInfo serv in group.Services)
                                        if (groupNew)
                                        {
                                            foreach (QBCodeInfo code in servCodes)
                                            {
                                                if (task.TaskType != GroupTypeEnum.Non_Deliverable)
                                                {
                                                    xmlString += "<InvoiceLineAdd>";
                                                    xmlString += "<ItemRef><FullName>" + code.QBCode.Replace("&", "&#038;") + "</FullName></ItemRef>";
                                                    xmlString += "<Desc>" + lib.Title.Replace("&", "&#038;"); //code.QBCode.Replace("&", "&#038;");
                                                    if (woIds.Count > 1 && j == 0)
                                                    {
                                                        xmlString += " WO " + wo.Id.ToString();
                                                    }
                                                    xmlString += "</Desc>";
                                                    if (task.Quantity == 0)
                                                    {
                                                        task.Quantity = 1;
                                                    }
                                                    xmlString += "<Quantity>" + group.LibraryItems.Count.ToString() + "</Quantity>";
                                                    xmlString += "<Other1></Other1>";
                                                    xmlString += "<Other2></Other2></InvoiceLineAdd>";
                                                }
                                                else
                                                {
                                                    xmlString += "<InvoiceLineAdd>";
                                                    xmlString += "<ItemRef><FullName>" + code.QBCode.Replace("&", "&#038;") + "</FullName></ItemRef>";
                                                    xmlString += "<Desc>" + master.Title.Replace("&", "&#038;");
                                                    if (woIds.Count > 1 && j == 0)
                                                    {
                                                        xmlString += " WO " + wo.Id.ToString();
                                                    }
                                                    xmlString += "</Desc>";
                                                    if (task.Quantity == 0)
                                                    {
                                                        task.Quantity = 1;
                                                    }
                                                    xmlString += "<Quantity>" + task.Quantity + "</Quantity>";
                                                    xmlString += "<Other1>" + lib.ProductDescription.Trim().Replace("&", "&#038;") + "</Other1>";
                                                    xmlString += "<Other2>" + lib.ISCICode.Trim().Replace("&", "&#038;") + "</Other2></InvoiceLineAdd>";
                                                }
                                            }
                                            groupNew = false;
                                        }
                                    }
                                    if (task.TaskType == GroupTypeEnum.Bundle || task.TaskType == GroupTypeEnum.Delivery || task.TaskType == GroupTypeEnum.Customized)
                                    {
                                        LibraryItemInfo lib  = aCont.Get_LibraryItemById(task.LibraryId);
                                        bool            isHd = lib.MediaType.IndexOf("HD") != -1;
                                        string[]        pcs  = lib.MediaLength.Split(':');
                                        int             secs = 0;
                                        if (pcs.Length == 2)
                                        {
                                            try
                                            {
                                                secs = 60 * Convert.ToInt32(pcs[0]) + Convert.ToInt32(pcs[1]);
                                            }
                                            catch { }
                                        }
                                        if (secs <= 120 && !isHd)
                                        {
                                            custIndex = 2;
                                        }
                                        else if (secs <= 120 && isHd)
                                        {
                                            custIndex = 3;
                                        }
                                        else if (secs >= 1500 && secs <= 1800 && !isHd)
                                        {
                                            custIndex = 0;
                                        }
                                        else if (secs >= 1500 && secs <= 1800 && isHd)
                                        {
                                            custIndex = 1;
                                        }
                                        else if (secs >= 180 && secs <= 300 && !isHd)
                                        {
                                            custIndex = 4;
                                        }
                                        else if (secs >= 180 && secs <= 300 && !isHd)
                                        {
                                            custIndex = 5;
                                        }
                                        xmlString += "<InvoiceLineAdd>";
                                        if (task.TaskType != GroupTypeEnum.Customized)
                                        {
                                            xmlString += "<ItemRef><FullName>" + task.QBCode.Trim().Replace("&", "&#038;") + "</FullName></ItemRef>";
                                        }
                                        else
                                        {
                                            xmlString += "<ItemRef><FullName>" + custCodes[custIndex] + "</FullName></ItemRef>";
                                        }
                                        xmlString += "<Desc>" + lib.Title.Trim().Replace("&", "&#038;");
                                        if (woIds.Count > 1 && j == 0)
                                        {
                                            xmlString += " WO " + wo.Id.ToString();
                                        }
                                        xmlString += "</Desc>";
                                        if (task.Quantity == 0)
                                        {
                                            task.Quantity = 1;
                                        }
                                        xmlString += "<Quantity>" + task.Quantity + "</Quantity>";
                                        xmlString += "<Other1>" + lib.ProductDescription.Trim().Replace("&", "&#038;") + "</Other1>";
                                        if (lib.TapeCode.Trim() == "")
                                        {
                                            xmlString += "<Other2>" + lib.ISCICode.Trim().Replace("&", "&#038;") + "</Other2></InvoiceLineAdd>";
                                        }
                                        else
                                        {
                                            xmlString += "<Other2>" + lib.TapeCode.Trim().Replace("&", "&#038;") + "</Other2></InvoiceLineAdd>";
                                        }
                                        WOGroupStationInfo station = aCont.Get_WorkOrderGroupStationById(task.StationId);
                                        if (station.DeliveryMethod.ToLower().IndexOf("tf_") != -1)
                                        {
                                            //check to see if we need to add shipping
                                            if (station.ShippingMethodId == -1)
                                            {
                                                int            weight = 1;
                                                TapeFormatInfo tape   = aCont.Get_TapeFormatById(Convert.ToInt32(station.DeliveryMethod.Replace("tf_", "")));
                                                if (station.Quantity * tape.Weight > 1.0)
                                                {
                                                    weight = 2;
                                                }
                                                string shippingPrice = "";
                                                if (weight == 1)
                                                {
                                                    if (station.PriorityId == 1)
                                                    {
                                                        shippingPrice = ConfigurationManager.AppSettings["FedEx1LbPriority"].ToString();
                                                    }
                                                    else if (station.PriorityId == 2)
                                                    {
                                                        shippingPrice = ConfigurationManager.AppSettings["FedEx1LbStandard"].ToString();
                                                    }
                                                    else if (station.PriorityId == 3)
                                                    {
                                                        shippingPrice = ConfigurationManager.AppSettings["FedEx1Lb2Day"].ToString();
                                                    }
                                                }
                                                else
                                                {
                                                    if (station.PriorityId == 1)
                                                    {
                                                        shippingPrice = ConfigurationManager.AppSettings["FedEx2LbPriority"].ToString();
                                                    }
                                                    else if (station.PriorityId == 2)
                                                    {
                                                        shippingPrice = ConfigurationManager.AppSettings["FedEx2LbStandard"].ToString();
                                                    }
                                                    else if (station.PriorityId == 3)
                                                    {
                                                        shippingPrice = ConfigurationManager.AppSettings["FedEx2Lb2Day"].ToString();
                                                    }
                                                }
                                                xmlString += "<InvoiceLineAdd><ItemRef><FullName>SHIPPING</FullName></ItemRef><Desc>P" + station.PriorityId.ToString() + " " + weight.ToString() + "LB SHIPPING CHARGE</Desc><Quantity>1</Quantity><Rate>" + shippingPrice + "</Rate></InvoiceLineAdd>";
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                    xmlString += "</InvoiceAdd></InvoiceAddRq>";
                    //xmlString += "";
                }
                xmlString += "</QBXMLMsgsRq></QBXML>";
                req        = xmlString;
                //}
            }
            return(req);
        }
Exemple #23
0
        public int receiveResponseXML(string ticket, string response, string hresult, string message)
        {
            string evLogTxt = "WebMethod: receiveResponseXML() called by QBWebconnector" + Environment.NewLine;

            evLogTxt = evLogTxt + "Parameters received:" + Environment.NewLine;
            evLogTxt = evLogTxt + "string ticket = " + ticket + Environment.NewLine;
            evLogTxt = evLogTxt + "string response = " + response + Environment.NewLine;
            evLogTxt = evLogTxt + "string hresult = " + hresult + Environment.NewLine;
            evLogTxt = evLogTxt + "string message = " + message + Environment.NewLine;
            int retVal = 0;

            //if (!hresult.ToString().Equals(""))
            //{
            // if error in the response, web service should return a negative int
            evLogTxt += "HRESULT = " + hresult + Environment.NewLine;
            evLogTxt += "Message = " + message + Environment.NewLine;
            XmlDocument doc = new XmlDocument();

            doc.LoadXml(response);
            XmlElement xelRoot = doc.DocumentElement;
            bool       error   = false;

            if (xelRoot != null)
            {
                XmlNodeList nodes = xelRoot.GetElementsByTagName("InvoiceAddRs");
                if (nodes[0] != null)
                {
                    if (nodes[0].Attributes["statusSeverity"].Value.ToLower() == "error")
                    {
                        error     = true;
                        evLogTxt += "Error: BillTo Not set up in Quickbooks. " + Environment.NewLine;
                        retVal    = -101;
                        //string reqId = nodes[0].Attributes["requestID"].Value;
                        //Session["AddCustomer"] = reqId.Substring(0, reqId.IndexOf("_"));
                    }
                }
                if (!error)
                {
                    //invoice created
                    //TODO: Update all invoices if multi add worked
                    XmlNodeList invNodes = xelRoot.GetElementsByTagName("InvoiceRet");
                    if (invNodes != null)
                    {
                        evLogTxt += "InvoiceRet: " + invNodes.Count.ToString() + Environment.NewLine;
                        foreach (XmlNode invNode in invNodes)
                        {
                            XmlNode txnNode = invNode.SelectSingleNode("RefNumber");
                            if (txnNode != null)
                            {
                                evLogTxt += "TxnNumber: " + txnNode.InnerText + Environment.NewLine;
                                XmlNode invNo = invNode.SelectSingleNode("Memo");
                                if (invNo != null)
                                {
                                    evLogTxt += "Memo: " + invNo.InnerText + Environment.NewLine;
                                    InvoiceInfo inv = aCont.Get_InvoiceById(Convert.ToInt32(invNo.InnerText));
                                    if (inv.Id != -1)
                                    {
                                        inv.SentToQB         = true;
                                        inv.QBInvoiceNumber  = txnNode.InnerText;
                                        inv.LastModifiedDate = DateTime.Now;
                                        aCont.Update_Invoice(inv);
                                        List <int> woIds = aCont.Get_WOInsByInvoiceId(inv.Id);
                                        foreach (int woId in woIds)
                                        {
                                            WorkOrderInfo wo = aCont.Get_WorkOrderById(woId);
                                            wo.InvoiceNumber = inv.QBInvoiceNumber;
                                            //wo.LastModifiedDate = DateTime.Now;
                                            wo.Status = "INVOICED";
                                            aCont.Update_WorkOrder(wo);
                                        }
                                        evLogTxt += "WO's updated." + Environment.NewLine;
                                    }
                                }
                            }
                        }
                    }
                }
                retVal = 100;
            }
            //}
            //else
            //{
            //    evLogTxt = evLogTxt + "Length of response received = " + response.Length + Environment.NewLine;
            //    //ArrayList req = buildRequest(ticket);
            //    //int total = req.Count;
            //    //int count = Convert.ToInt32(Session["counter"]);
            //    //int percentage = (count * 100) / total;
            //    //if (percentage >= 100)
            //    //{
            //    //    count = 0;
            //    //    Session["counter"] = 0;
            //    //}
            //    retVal = 100;
            //}
            evLogTxt = evLogTxt + Environment.NewLine;
            evLogTxt = evLogTxt + "Return values: " + Environment.NewLine;
            evLogTxt = evLogTxt + "int retVal= " + retVal.ToString() + Environment.NewLine;
            logEvent(evLogTxt);
            //TODO: Add update workorder to add invoice id
            return(retVal);
        }
 public abstract void Delete_WorkOrder(WorkOrderInfo WorkOrder);
Exemple #25
0
        public ActionResult WorkOrderSubmmit(WorkOrderInfo model)
        {
            var result = MaterialBusiness.SaveWorkOrder(model, this.LoginUser);

            return(Json(result));
        }
 private void drawAddresses()
 {
     if (Request.QueryString["woid"] != null)
     {
         AdminController aCont       = new AdminController();
         WorkOrderInfo   wo          = aCont.Get_WorkOrderById(Convert.ToInt32(Request.QueryString["woid"]));
         List <TaskInfo> tasks       = aCont.Get_TasksByWOId(wo.Id);
         bool            hasShipping = false;
         if (ViewState["popupFirst"] == null)
         {
             ViewState["popupFirst"] = "false";
         }
         foreach (WOGroupInfo group in wo.Groups)
         {
             Literal litGroupTitle = new Literal();
             litGroupTitle.ID   = "litGroupTitle_" + group.Id.ToString();
             litGroupTitle.Text = "<h3>" + group.GroupName + "</h3>";
             pnlAddresses.Controls.Add(litGroupTitle);
             foreach (WOGroupStationInfo station in group.WOGroupStations)
             {
                 if (station.DeliveryMethod.IndexOf("tf_") != -1)
                 {
                     bool showThis = false;
                     var  task     = tasks.FirstOrDefault(o => o.WOGroupId == group.Id && o.StationId == station.Id);
                     if (task != null && task.DeliveryStatus != "COMPLETE" && task.DeliveryStatus != "CANCELLED" || (task.DeliveryStatus == "PENDING" && task.DeliveryOrderId == ""))
                     {
                         showThis = true;
                     }
                     if (showThis)
                     {
                         hasShipping = true;
                         Literal lit1 = new Literal();
                         lit1.ID = "lit1_" + group.Id.ToString() + "_" + station.Id.ToString();
                         if (ViewState["popupFirst"].ToString() == "true")
                         {
                             lit1.Text = "<div class=\"col25\">Station:</div><div class=\"col50\">" + station.Station.StationName + "</div><br clear=\"both\" /><div class=\"col25\">Street1:</div><div class=\"col50\">";
                         }
                         pnlAddresses.Controls.Add(lit1);
                         TextBox txtStreet1 = new TextBox();
                         txtStreet1.ID = "txtStreet1_" + group.Id.ToString() + "_" + station.Id.ToString();
                         if (ViewState["popupFirst"].ToString() == "true")
                         {
                             txtStreet1.Text = station.Station.Address1;
                         }
                         pnlAddresses.Controls.Add(txtStreet1);
                         Literal lit2 = new Literal();
                         lit2.ID = "lit2_" + group.Id.ToString() + "_" + station.Id.ToString();
                         if (ViewState["popupFirst"].ToString() == "true")
                         {
                             lit2.Text = "</div><br clear=\"both\" /><div class=\"col25\">Street2:</div><div class=\"col50\">";
                         }
                         pnlAddresses.Controls.Add(lit2);
                         TextBox txtStreet2 = new TextBox();
                         txtStreet2.ID = "txtStreet2_" + group.Id.ToString() + "_" + station.Id.ToString();
                         if (ViewState["popupFirst"].ToString() == "true")
                         {
                             txtStreet2.Text = station.Station.Address2;
                         }
                         pnlAddresses.Controls.Add(txtStreet2);
                         Literal lit3 = new Literal();
                         lit3.ID = "lit3_" + group.Id.ToString() + "_" + station.Id.ToString();
                         if (ViewState["popupFirst"].ToString() == "true")
                         {
                             lit3.Text = "</div><br clear=\"both\" /><div class=\"col25\">City:</div><div class=\"col50\">";
                         }
                         pnlAddresses.Controls.Add(lit3);
                         TextBox txtCity = new TextBox();
                         txtCity.ID = "txtCity_" + group.Id.ToString() + "_" + station.Id.ToString();
                         if (ViewState["popupFirst"].ToString() == "true")
                         {
                             txtCity.Text = station.Station.City;
                         }
                         pnlAddresses.Controls.Add(txtCity);
                         Literal lit4 = new Literal();
                         lit4.ID = "lit4_" + group.Id.ToString() + "_" + station.Id.ToString();
                         if (ViewState["popupFirst"].ToString() == "true")
                         {
                             lit4.Text = "</div><br clear=\"both\" /><div class=\"col25\">State:</div><div class=\"col50\">";
                         }
                         pnlAddresses.Controls.Add(lit4);
                         TextBox txtState = new TextBox();
                         txtState.ID = "txtState_" + group.Id.ToString() + "_" + station.Id.ToString();
                         if (ViewState["popupFirst"].ToString() == "true")
                         {
                             txtState.Text = station.Station.State;
                         }
                         pnlAddresses.Controls.Add(txtState);
                         Literal lit5 = new Literal();
                         lit5.ID = "lit5_" + group.Id.ToString() + "_" + station.Id.ToString();
                         if (ViewState["popupFirst"].ToString() == "true")
                         {
                             lit5.Text = "</div><br clear=\"both\" /><div class=\"col25\">Zip:</div><div class=\"col50\">";
                         }
                         pnlAddresses.Controls.Add(lit5);
                         TextBox txtZip = new TextBox();
                         txtZip.ID = "txtZip_" + group.Id.ToString() + "_" + station.Id.ToString();
                         if (ViewState["popupFirst"].ToString() == "true")
                         {
                             txtZip.Text = station.Station.Zip;
                         }
                         pnlAddresses.Controls.Add(txtZip);
                         Literal lit6 = new Literal();
                         lit6.ID = "lit6_" + group.Id.ToString() + "_" + station.Id.ToString();
                         if (ViewState["popupFirst"].ToString() == "true")
                         {
                             lit6.Text = "</div><br clear=\"both\" /><div class=\"col25\">Attention:</div><div class=\"col50\">";
                         }
                         pnlAddresses.Controls.Add(lit6);
                         TextBox txtAttentionLine = new TextBox();
                         txtAttentionLine.ID = "txtAttentionLine_" + group.Id.ToString() + "_" + station.Id.ToString();
                         if (ViewState["popupFirst"].ToString() == "true")
                         {
                             txtAttentionLine.Text = station.Station.AttentionLine;
                         }
                         pnlAddresses.Controls.Add(txtAttentionLine);
                         Literal lit6b = new Literal();
                         lit6b.ID = "lit6b_" + group.Id.ToString() + "_" + station.Id.ToString();
                         if (ViewState["popupFirst"].ToString() == "true")
                         {
                             lit6b.Text = "</div><br clear=\"both\" /><div class=\"col25\">Phone:</div><div class=\"col50\">";
                         }
                         pnlAddresses.Controls.Add(lit6b);
                         TextBox txtPhone = new TextBox();
                         txtPhone.ID = "txtPhone_" + group.Id.ToString() + "_" + station.Id.ToString();
                         if (ViewState["popupFirst"].ToString() == "true")
                         {
                             txtPhone.Text = station.Station.Phone;
                         }
                         pnlAddresses.Controls.Add(txtPhone);
                         Literal lit7 = new Literal();
                         lit7.ID = "lit7_" + group.Id.ToString() + "_" + station.Id.ToString();
                         if (ViewState["popupFirst"].ToString() == "true")
                         {
                             lit7.Text = "</div><br clear=\"both\" /><br />";
                         }
                         pnlAddresses.Controls.Add(lit7);
                     }
                 }
             }
         }
         if (ViewState["popupFirst"].ToString() == "true")
         {
             ViewState["popupFirst"] = "false";
         }
     }
 }
Exemple #27
0
        /// <summary>
        /// 取的runcard的資料來源
        /// </summary>
        /// <param name="LotDataList"></param>
        /// <returns></returns>
        private DataView GetRunCardDataSource(List <LotInfo> LotDataList)
        {
            string sql = "";

            DataTable dtReportData = new DataTable();

            dtReportData.Columns.Add("OPERSEQ");
            dtReportData.Columns.Add("OPERNO");
            dtReportData.Columns.Add("Operation");
            dtReportData.Columns.Add("OperationDescr");
            dtReportData.Columns.Add("RECIPEID");
            dtReportData.Columns.Add("EDC");
            dtReportData.Columns.Add("ERP_Route_LTEXT");
            dtReportData.Columns.Add("ERP_Route_LTXA1");

            LotDataList.ForEach(p =>
            {
                var workOrder       = WorkOrderInfo.GetWorkOrderByWorkOrder(p.WorkOrder);
                var lstCstRouteInfo = CSTWPCWorkOrderRouteInfo.GetDataByWorkOrder(workOrder.WorkOrder);

                #region RouteOperationInfo
                sql = @" SELECT O.OPERATIONNO, O.DESCR, ROUTEOPER.* 
                       FROM MES_PRC_ROUTE_OPER ROUTEOPER ,MES_PRC_ROUTE_VER ROUTEVER ,MES_PRC_ROUTE ROUTE ,MES_PRC_OPER O
                      WHERE ROUTE.PRC_ROUTE_SID = ROUTEVER.PRC_ROUTE_SID 
                        AND ROUTEVER.PRC_ROUTE_VER_SID = ROUTEOPER.PRC_ROUTE_VER_SID
                        AND ROUTEOPER.OPERNAME = O.OPERATION
                        AND ROUTEVER.ROUTE = #[STRING]
                        AND ROUTEVER.VERSION = #[DECIMAL]
                      ORDER BY OPERSEQ";

                List <RouteOperationInfo> routeOpers = InfoCenter.GetList <RouteOperationInfo>(sql, p.RouteName, p.RouteVersion);
                #endregion

                #region 工作站
                routeOpers.ForEach(oper =>
                {
                    DataRow dr           = dtReportData.NewRow();
                    dr["OPERSEQ"]        = oper.OperationSequence;
                    dr["Operation"]      = oper.OperationName;
                    dr["OPERNO"]         = oper["OPERATIONNO"].ToString();
                    dr["OperationDescr"] = oper["DESCR"].ToString();

                    var cstOperDataInfo = CSTPRCOperationMappingDataInfo.GetOperationMappingDataByMESOperation(oper.OperationName);
                    if (cstOperDataInfo != null)
                    {
                        var cstOperInfo = InfoCenter.GetBySID <CSTPRCOperationMappingInfo>(cstOperDataInfo.PRCOperationMappingSID);
                        if (cstOperInfo != null)
                        {
                            var cstRouteInfo = lstCstRouteInfo.Find(route => route.ARBPL == cstOperInfo.ERPOperation);
                            if (cstRouteInfo != null)
                            {
                                dr["ERP_Route_LTEXT"] = cstRouteInfo["LTEXT"].ToString();
                                dr["ERP_Route_LTXA1"] = cstRouteInfo["LTXA1"].ToString();
                            }
                        }
                    }

                    dtReportData.Rows.Add(dr);
                });
                #endregion
            });

            dtReportData.AcceptChanges();
            DataView dvReportData = new DataView(dtReportData);

            dvReportData.Sort            = "OPERSEQ";
            dvReportData.Table.TableName = "MES_OPER_RECIPE";

            return(dvReportData);
        }
Exemple #28
0
 public void I_WorkOrder(WorkOrderInfo workOrderInfo, string code, string typecode)//新增随工单
 {
     iwo.I_WorkOrder(workOrderInfo, code, typecode);
 }