1
zgq
2021-08-16 f52d27c5ae0e0d128fa44477ef1daa80aece6d00
PlanM/Êý¾Ýµ¼Èë/Gy_DataIn_RoutingBill.cs
@@ -17,29 +17,29 @@
            InitializeComponent();
        }
        public int HMaterNumberCol = 0;             //产品代码
        public int HProcNoCol = 0;       //工序序号
        public int HProcNameCol = 0;           //工序
        public int HWorkCenterNameCol = 0;        //工作中心
        public int HWorkQtyCol = 0;          //加工数量
        public int HBeginDayQtyCol = 6;     //开工固天
        public int HBeginFixQtyCol = 7;     //开工余量
        public int HFixPriceCol = 8;        //定额 å°æ—¶å·¥èµ„
        public int HProcPriceCol = 9;       //工价
        public int HTechnologyParameterCol = 0;       //工艺参数
        public int HPicNumCol = 0;       //图纸编号
        public int HProcCheckNoteCol = 0;       //本工序确认记录
        public int HMaterNumberCol = 0;             //???????
        public int HProcNoCol = 0;       //???????
        public int HProcNameCol = 0;           //????
        public int HWorkCenterNameCol = 0;        //????????
        public int HWorkQtyCol = 0;          //???????
        public int HBeginDayQtyCol = 6;     //????????
        public int HBeginFixQtyCol = 7;     //????????
        public int HFixPriceCol = 8;        //???? Ð¡?????
        public int HProcPriceCol = 9;       //????
        public int HTechnologyParameterCol = 0;       //???????
        public int HPicNumCol = 0;       //?????
        public int HProcCheckNoteCol = 0;       //???????????
        public int HPicNumVerCol = 0;       //图号版本
        public int HPicNumAssembleCol = 0;       //总装图号
        public int HMaterTextureCol = 0;       //材质
        public int HProductNumCol = 0;       //成品编号
        public int HVerNumCol = 0;       //版本
        public int HMouldNoCol = 0;       //模具编号
        public int HProcWorkNumCol = 0;        //程序号
        public int HPassRateCol = 0;        //良率
        public int HPicNumVerCol = 0;       //???æ±¾
        public int HPicNumAssembleCol = 0;       //??????
        public int HMaterTextureCol = 0;       //????
        public int HProductNumCol = 0;       //??????
        public int HVerNumCol = 0;       //?æ±¾
        public int HMouldNoCol = 0;       //?????
        public int HProcWorkNumCol = 0;        //?????
        public int HPassRateCol = 0;        //????
        //
        public const int HBeginRow = 2;         //有效数据,开始行数
        public const int HBeginRow = 2;         //??Ч????????????
        // 
        public DAL.ClsGy_Process_View oProcHlp = new DAL.ClsGy_Process_View();
        DAL.ClsGy_WorkCenter_View oCenHlp = new DAL.ClsGy_WorkCenter_View();
@@ -57,7 +57,7 @@
        }
        /// <summary>
        ///  åˆå§‹åŒ–界面
        ///  ?????????
        /// </summary>
        public override void initData()
        {
@@ -70,7 +70,7 @@
            base.ModRightNameEdit = base.ModRightName + base.ModRightNameEdit;
            base.ModRightNameMoney = base.ModRightName + base.ModRightNameMoney;
            base.ModRightNameQty = base.ModRightName + base.ModRightNameQty;
            base.ModCaption = "工艺路线导入";
            base.ModCaption = "????·?????";
            this.Text = base.ModCaption;
            lblCaption.Text = base.ModCaption;
            //
@@ -78,7 +78,7 @@
            DBUtility.Gy_BaseFun.SetComboxPeriod(cmbHPeriod);
            //
        }
        //导入
        //????
        public override void Sub_DataIn()
        {
            try
@@ -86,26 +86,26 @@
                string hnumber = "";
                string HBillNo = "";
                //
                HMaterNumberCol = DBUtility.Gy_BaseFun.Fun_GetCol("产品代码", grdMain);
                HProcNoCol = DBUtility.Gy_BaseFun.Fun_GetCol("工序序号", grdMain);
                HProcNameCol = DBUtility.Gy_BaseFun.Fun_GetCol("工序", grdMain);
                HWorkCenterNameCol = DBUtility.Gy_BaseFun.Fun_GetCol("工作中心", grdMain);
                HWorkQtyCol = DBUtility.Gy_BaseFun.Fun_GetCol("加工数量", grdMain);
                HPicNumCol = DBUtility.Gy_BaseFun.Fun_GetCol("图纸编号", grdMain);
                HTechnologyParameterCol = DBUtility.Gy_BaseFun.Fun_GetCol("工艺参数", grdMain);
                HProcCheckNoteCol = DBUtility.Gy_BaseFun.Fun_GetCol("本工序确认记录", grdMain);
                HPicNumVerCol = DBUtility.Gy_BaseFun.Fun_GetCol("图号版本", grdMain);
                HPicNumAssembleCol = DBUtility.Gy_BaseFun.Fun_GetCol("总装图号", grdMain);
                HMaterTextureCol = DBUtility.Gy_BaseFun.Fun_GetCol("材质", grdMain);
                HProductNumCol = DBUtility.Gy_BaseFun.Fun_GetCol("成品编号", grdMain);
                HVerNumCol = DBUtility.Gy_BaseFun.Fun_GetCol("版本", grdMain);
                HMouldNoCol = DBUtility.Gy_BaseFun.Fun_GetCol("模具编号", grdMain);
                HProcWorkNumCol = DBUtility.Gy_BaseFun.Fun_GetCol("程序号", grdMain);
                HBeginFixQtyCol = DBUtility.Gy_BaseFun.Fun_GetCol("开工余量", grdMain);
                HBeginDayQtyCol = DBUtility.Gy_BaseFun.Fun_GetCol("开工固天", grdMain);
                HFixPriceCol = DBUtility.Gy_BaseFun.Fun_GetCol("小时工资", grdMain);
                HProcPriceCol = DBUtility.Gy_BaseFun.Fun_GetCol("单个工价", grdMain);
                HPassRateCol = DBUtility.Gy_BaseFun.Fun_GetCol("良率", grdMain);
                HMaterNumberCol = DBUtility.Gy_BaseFun.Fun_GetCol("???????", grdMain);
                HProcNoCol = DBUtility.Gy_BaseFun.Fun_GetCol("???????", grdMain);
                HProcNameCol = DBUtility.Gy_BaseFun.Fun_GetCol("????", grdMain);
                HWorkCenterNameCol = DBUtility.Gy_BaseFun.Fun_GetCol("????????", grdMain);
                HWorkQtyCol = DBUtility.Gy_BaseFun.Fun_GetCol("???????", grdMain);
                HPicNumCol = DBUtility.Gy_BaseFun.Fun_GetCol("?????", grdMain);
                HTechnologyParameterCol = DBUtility.Gy_BaseFun.Fun_GetCol("???????", grdMain);
                HProcCheckNoteCol = DBUtility.Gy_BaseFun.Fun_GetCol("???????????", grdMain);
                HPicNumVerCol = DBUtility.Gy_BaseFun.Fun_GetCol("???æ±¾", grdMain);
                HPicNumAssembleCol = DBUtility.Gy_BaseFun.Fun_GetCol("??????", grdMain);
                HMaterTextureCol = DBUtility.Gy_BaseFun.Fun_GetCol("????", grdMain);
                HProductNumCol = DBUtility.Gy_BaseFun.Fun_GetCol("??????", grdMain);
                HVerNumCol = DBUtility.Gy_BaseFun.Fun_GetCol("?æ±¾", grdMain);
                HMouldNoCol = DBUtility.Gy_BaseFun.Fun_GetCol("?????", grdMain);
                HProcWorkNumCol = DBUtility.Gy_BaseFun.Fun_GetCol("?????", grdMain);
                HBeginFixQtyCol = DBUtility.Gy_BaseFun.Fun_GetCol("????????", grdMain);
                HBeginDayQtyCol = DBUtility.Gy_BaseFun.Fun_GetCol("????????", grdMain);
                HFixPriceCol = DBUtility.Gy_BaseFun.Fun_GetCol("С?????", grdMain);
                HProcPriceCol = DBUtility.Gy_BaseFun.Fun_GetCol("????????", grdMain);
                HPassRateCol = DBUtility.Gy_BaseFun.Fun_GetCol("????", grdMain);
                //没有找到列
                if (HMaterNumberCol == -1)
@@ -251,7 +251,7 @@
                        if (hnumber == DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HMaterNumberCol].Value))
                        {
                            //得到物料内码
                            //???????????
                            if (oMaterHlp.GetInfoByNumber(sHNumber))
                            {
                                if (BillNew.omodel.HMaterID != oMaterHlp.omodel.HItemID)
@@ -266,11 +266,11 @@
                            else
                            {
                                BillNew.omodel.HMaterID = 0;
                                MessageBox.Show("第" + i.ToString() + "行," + sHNumber + "没有找到对应的物料!");
                                MessageBox.Show("??" + i.ToString() + "??," + sHNumber + "????????????????");
                                return;
                            }
                            j++;
                            //写入类
                            //д????
                            WriteClass(i);
                        }
@@ -279,18 +279,18 @@
                            DataSet Ds;
                            ClsCN oCn = new ClsCN();
                            bool b = false;
                            // åˆ¤æ–­æ˜¯å¦å­˜åœ¨å·¥è‰ºè·¯çº¿
                            // ?ж??????????·??
                            Ds = oCn.RunProcReturn("Select HMaterID from Gy_RoutingBillMain Where HMaterID=" + BillNew.omodel.HMaterID.ToString(), "Gy_RoutingBillMain");
                            if (checkadd.Checked == true)
                            {
                                //if (Ds.Tables[0].Rows.Count == 0)//追加
                                //if (Ds.Tables[0].Rows.Count == 0)//???
                                //{
                                //新增前 å…ˆåˆ é™¤åŽŸæ¥å·¥è‰º
                                //????? ????????????
                                BillNew.DeleteByMaterID(BillNew.omodel.HMaterID);
                                b = BillNew.AddBill(ref ClsPub.sExeReturnInfo);
                                if (b == false)
                                {
                                    MessageBox.Show("第" + i.ToString() + "行,物料" + BillNew.omodel.HMaterNumber + "新增工艺路线失败!代码293行中,原因:" + ClsPub.sExeReturnInfo);
                                    MessageBox.Show("??" + i.ToString() + "??,????" + BillNew.omodel.HMaterNumber + "????????·??????????293???У????" + ClsPub.sExeReturnInfo);
                                    return;
                                }
                                c++;
@@ -319,13 +319,13 @@
                            hnumber = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HMaterNumberCol].Value);
                            sHNumber = DBUtility.ClsPub.isStrNull(grdMain.Rows[i].Cells[HMaterNumberCol].Value);
                            //审核代码是否合理
                            //????????????
                            if (!DBUtility.ClsPub.AllowNumber(sHNumber))
                            {
                                MessageBox.Show("物料代码中不能出现连续‘.’并且首位末位不能为‘.’!", "提示");
                                MessageBox.Show("????????в????????????.????????λ?λ???????.????", "???");
                                return;
                            }
                            //得到物料内码
                            //???????????
                            if (oMaterHlp.GetInfoByNumber(sHNumber))
                            {
                                if (BillNew.omodel.HMaterID != oMaterHlp.omodel.HItemID)
@@ -382,7 +382,7 @@
            }
        }
        //写入类 ä»ŽæŽ§ä»¶
        //д???? ????
        private bool WriteClass(int row)
        {
            string sHNumber = "";
@@ -402,22 +402,22 @@
            sBeginDayQty = DBUtility.ClsPub.isSingle(grdMain.Rows[row].Cells[HBeginDayQtyCol].Value);
            sBeginFixQty = DBUtility.ClsPub.isSingle(grdMain.Rows[row].Cells[HBeginFixQtyCol].Value);
            sHPassRate = DBUtility.ClsPub.isSingle(grdMain.Rows[row].Cells[HPassRateCol].Value);
            //判断是否允许 ä¿å­˜
            //?ж???????? ????
            Model.ClsGy_RoutingBillSub oSub = new Model.ClsGy_RoutingBillSub();
            //得到工序内码
            //???????????
            if (oProcHlp.GetInfoByName(sHNamePoc))
            {
                oSub.HProcID = oProcHlp.omodel.HItemID;
            }
            //得到车间内码
            //???????????
            if (oCenHlp.GetInfoByName(sHNumberCen))
            {
                oSub.HCenterID = oCenHlp.omodel.HItemID;
            }
            //写入信息
            //д?????
            oSub.HEntryID = j;
            oSub.HProcNo = DBUtility.ClsPub.isInt(grdMain.Rows[row].Cells[HProcNoCol].Value);
@@ -425,7 +425,7 @@
            oSub.HWorkQty = sWorkQty;
            oSub.HPassRate = sHPassRate;
            oSub.HRemark = "";
            oSub.HTimeUnit = "Сʱ";
            oSub.HTimeUnit = "С?";
            oSub.HReadyTime = 0;
            oSub.HQueueTime = 0;
            oSub.HMoveTime = 0;
@@ -457,7 +457,7 @@
            return true;
        }
        //检查物料
        //???????
        private bool Checkdata()
        {
            bool b = false;
@@ -481,53 +481,53 @@
                {
                    // 
                    int index = i + 1;
                    //加工数量不能小于等于零
                    //???????????С???????
                    if (sWorkQty <= 0)
                    {
                        MessageBox.Show("第" + index + "行加工数量不能小于等于零!", "提示");
                        MessageBox.Show("??" + index + "?м??????????С???????", "???");
                        return false;
                    }
                    //良率不能小于等于零
                    //???????С???????
                    if (sHPassRate <= 0)
                    {
                        MessageBox.Show("第" + index + "行良率不能小于等于零!", "提示");
                        MessageBox.Show("??" + index + "?????????С???????", "???");
                        return false;
                    }
                    //审核代码是否合理
                    //????????????
                    if (!DBUtility.ClsPub.AllowNumber(sHNumber))
                    {
                        MessageBox.Show("物料代码中不能出现连续‘.’并且首位末位不能为‘.’!", "提示");
                        MessageBox.Show("????????в????????????.????????λ?λ???????.????", "???");
                        return false;
                    }
                    //得到物料内码
                    //???????????
                    int j = i + HBeginRow;
                    if (!oMaterHlp.GetInfoByNumber(sHNumber))
                    {
                        sMsg = "[" + sHNumber + "]物料不存在";
                        sMsg = "[" + sHNumber + "]?????????";
                        if (sErrMsg.Contains(sMsg) == false)
                        {
                            sErrMsg = sErrMsg + "[" + sHNumber + "]物料不存在\r\n";
                            sErrMsg = sErrMsg + "[" + sHNumber + "]?????????\r\n";
                        }
                        b = true;
                    }
                    //得到工序内码
                    //???????????
                    if (!oProcHlp.GetInfoByName(sHNamePoc))
                    {
                        sMsg = "[" + sHNamePoc + "]工序不存在";
                        sMsg = "[" + sHNamePoc + "]????????";
                        if (sErrMsg.Contains(sMsg) == false)
                        {
                            sErrMsg = sErrMsg + "[" + sHNamePoc + "]工序不存在\r\n";
                            sErrMsg = sErrMsg + "[" + sHNamePoc + "]????????\r\n";
                        }
                        b = true;
                    }
                    //得到工作中心内码
                    //???????????????
                    if (!oCenHlp.GetInfoByName(sHNumberCen))
                    {
                        sMsg = "[" + sHNumberCen + "]工作中心不存在";
                        sMsg = "[" + sHNumberCen + "]?????????????";
                        if (sErrMsg.Contains(sMsg) == false)
                        {
                            sErrMsg = sErrMsg + "[" + sHNumberCen + "]工作中心不存在\r\n";
                            sErrMsg = sErrMsg + "[" + sHNumberCen + "]?????????????\r\n";
                        }
                        b = true;