예제 #1
0
        private void LoadDetails(int modid)
        {
            var wodal = new WorkOrderDAL();

            this.gridControl2.DataSource = wodal.GetWorkOrderList(modid);
            this.gridControl3.DataSource = wodal.GetRouter(modid);
        }
예제 #2
0
 private void ExecQuery()
 {
     this.dtM = dal.GetWorkOrderList(_whereList, _paramList);
     this.gridControl1.DataSource = dtM;
 }
예제 #3
0
        /// <summary>
        /// 指令单生成
        /// </summary>
        private void ExpDetail(object obj, EventArgs e)
        {
            #region 生成指令单

            if (dtM == null || dtM.Rows.Count < 1)
            {
                throw new Exception("表体没有记录!");
            }

            int modid = Convert.ToInt32(gridView1.GetFocusedRowCellValue("modid"));

            var wodal = new WorkOrderDAL();

            if (wodal.ExistWorkOrder(modid))
            {
                throw new Exception("已经生成指令单!");
            }
            else if (gridView1.GetFocusedRowCellValue("BomId").ToString() == "")
            {
                throw new Exception("生产订单没有选择BOM,请检查!");
            }
            //else if(!wodal.ExistBOM(modid))
            //{
            //    throw new Exception("没有BOM,请检查!");
            //}
            //是否存在工艺路线
            else if (!wodal.ExistPRouting(modid))
            {
                if (MsgBox.ShowYesNoMsg("没有工艺路线,是否加载默认工艺!") == DialogResult.Yes)
                {
                    dal.CreateWorkOrderRouting(modid, "001", Information.UserInfo.cUser_Name);
                }
                //throw new Exception("没用工艺路线,请检查");
            }
            else
            {
                dal.CreateWorkOrder(modid, Information.UserInfo.cUser_Name);
            }

            var dtWorkOrder = wodal.GetWorkOrderList(modid);
            var dtRouter    = wodal.GetRouter(modid);
            this.gridControl2.DataSource = dtWorkOrder;
            this.gridControl3.DataSource = dtRouter;


            //匹配指令单材料对应工序
            MatchOperation(modid);

            #region 检查已生成指令单是否有工艺路线
            string msg    = "";
            bool   bExist = false;
            foreach (DataRow r in dtWorkOrder.Rows)
            {
                foreach (DataRow r2 in dtRouter.Rows)
                {
                    if (r["WOCode"].ToString() == r2["WOCode"].ToString())
                    {
                        bExist = true;
                        break;
                    }

                    bExist = false;
                }

                if (!bExist)
                {
                    msg += r["WOCode"] + "没有工艺路线; \r\n";
                }
                else
                {
                    continue;
                }
            }
            if (msg != "")
            {
                MsgBox.ShowInfoMsg(msg);
            }

            #endregion

            #endregion

            using (var frm = new FmWOList(modid))
            {
                frm.ShowDialog();
            }
        }