Exemplo n.º 1
0
 private void PrepurOrder()
 {
     try
     {
         SM_BOMTEMP temp = new SM_BOMTEMP();
         G.BLL.ERP.BaseData.DM_ITEMLogic itemlogic = new G.BLL.ERP.BaseData.DM_ITEMLogic();
         SM_PREPURORDER prepur = new SM_PREPURORDER();
         if (tabControl1.SelectedIndex == 0)
         {
             this.Grid_CP.FinishEditing();
             temp = this.Grid_CP.GetCurSelect <SM_BOMTEMP>();
         }
         else
         {
             this.Grid_ZJ.FinishEditing();
             temp = this.Grid_ZJ.GetCurSelect <SM_BOMTEMP>();
         }
         prepur.PREPURQTY      = G.Core.GConvert.ToDecimal(temp.LEFTQTY);
         prepur.ORDERID        = temp.ORDERID;
         prepur.ORDLNNO        = temp.ORDLNNO;
         prepur.APPLYUSER      = G.AppInfo.GGlobal.User.USERDM;
         prepur.APPLYUSERNAME  = G.AppInfo.GGlobal.User.USERNAME;
         prepur.ITEMCODE       = temp.ITEMCODE;
         prepur.ITEMNAME       = temp.ITEMNAME;
         prepur.PURTYPE        = "1";
         prepur.INVUNIT        = temp.INVUNIT;
         prepur.BOMTEMPID      = temp.Id;
         prepur.ATTRIBUTEA     = temp.ATTRIBUTEA;
         prepur.ATTRIBUTEB     = temp.ATTRIBUTEB;
         prepur.ATTRIBUTEBNAME = temp.ATTRIBUTEBNAME;
         prepur.ATTRIBUTEC     = temp.ATTRIBUTEC;
         prepur.ATTRIBUTED     = temp.ATTRIBUTED;
         prepur.REMARK         = temp.MEMO;
         DM_ITEM itemobj = itemlogic.ExecuteSelect(CK.K["ITEMCODE"].Eq(temp.ITEMCODE), OrderBy.Parse("ITEMCODE"), 0, 0)[0];
         prepur.SUPCODE      = itemobj.SUPCODE;
         prepur.SUPPRICE     = itemobj.SUPPRICE;
         prepur.ISATTRIBUTEA = G.Core.GConvert.ToBool(itemobj.IsAttributeA);
         prepur.ISATTRIBUTEB = G.Core.GConvert.ToBool(itemobj.IsAttributeB);
         prepur.ISATTRIBUTEC = G.Core.GConvert.ToBool(itemobj.IsAttributeC);
         //弹出采购申请单,数据来自选择行
         Purchase.SM_PREPURORDEREDIT prepurEdit = new Purchase.SM_PREPURORDEREDIT();
         prepurEdit.SetData(prepur);
         DialogResult drst = prepurEdit.ShowDialog();
         if (drst == DialogResult.OK)
         {
             //采购数量填入BOMTEMP
             temp.PURQTY += temp.LEFTQTY;
             ((SM_BOMTEMPLogic)this.Logic).ExecuteUpdate(G.AppInfo.GGlobal.User, temp);
         }
         this.LoadGridCP(orderid, gxname);
         this.LoadGridShop(orderid, gxname);
         this.LoadGridZJ(orderid, gxname);
     }
     catch (Exception e)
     {
         MessageBox.Show(e.Message);
     }
 }
Exemplo n.º 2
0
        private void AssistMsupply()
        {
            try
            {
                SM_BOMTEMP temp = new SM_BOMTEMP();
                G.BLL.ERP.BaseData.DM_ITEMLogic itemlogic = new G.BLL.ERP.BaseData.DM_ITEMLogic();
                SM_SHOPSUPPLY shopsupply = new SM_SHOPSUPPLY();
                shopsupply.APPLYER     = G.AppInfo.GGlobal.User.USERDM;
                shopsupply.APPLYERNAME = G.AppInfo.GGlobal.User.USERNAME;
                shopsupply.APPLYDATE   = DateTime.Parse(BaseExtends.GetServerDate().ToShortDateString());
                G.BLL.Sys.ND_ORGINAZITIONLogic userlogic = new BLL.Sys.ND_ORGINAZITIONLogic();
                ND_ORGINAZITION userobj = userlogic.ExecuteSelect(CK.K["ID"].Eq(G.AppInfo.GGlobal.User.ORGID), OrderBy.Parse("ORGNAME"), 0, 0)[0];
                shopsupply.WORKSHOP = userobj.ORGDM;
                shopsupply.ORGNAME  = userobj.ORGNAME;

                SM_SHOPSUPPLYDTL dtl = new SM_SHOPSUPPLYDTL();
                if (tabControl1.SelectedIndex == 0)
                {
                    this.Grid_CP.FinishEditing();
                    temp       = this.Grid_CP.GetCurSelect <SM_BOMTEMP>();
                    dtl.ACTQTY = G.Core.GConvert.ToDecimal(temp.LEFTQTY);
                }
                else
                {
                    this.Grid_ZJ.FinishEditing();
                    temp = this.Grid_ZJ.GetCurSelect <SM_BOMTEMP>();
                    DM_ITEM itemobj1 = itemlogic.ExecuteSelect(CK.K["ITEMCODE"].Eq(temp.FATHERITEM), OrderBy.Parse("ITEMCODE"), 0, 0)[0];
                    if (temp.FATHERITEM.Substring(0, 4) == "S1LS")
                    {
                        dtl.ACTQTY = G.Core.GConvert.ToDecimal(temp.LEFTQTY * itemobj1.ISIZE / 100);
                    }
                    else
                    {
                        dtl.ACTQTY = G.Core.GConvert.ToDecimal(temp.LEFTQTY);
                    }
                }
                dtl.ITEMCODE       = temp.ITEMCODE;
                dtl.ITEMNAME       = temp.ITEMNAME;
                dtl.UNIT           = temp.INVUNIT;
                dtl.ATTRIBUTEA     = temp.ATTRIBUTEA;
                dtl.ATTRIBUTEB     = temp.ATTRIBUTEB;
                dtl.ATTRIBUTEBNAME = temp.ATTRIBUTEBNAME;
                dtl.ATTRIBUTEC     = temp.ATTRIBUTEC;
                dtl.ATTRIBUTED     = temp.ATTRIBUTED;
                dtl.MEMO           = temp.MEMO;
                dtl.BOMTEMPID      = temp.Id;
                DM_ITEM itemobj = itemlogic.ExecuteSelect(CK.K["ITEMCODE"].Eq(temp.ITEMCODE), OrderBy.Parse("ITEMCODE"), 0, 0)[0];
                dtl.ISATTRIBUTEA = G.Core.GConvert.ToBool(itemobj.IsAttributeA);
                dtl.ISATTRIBUTEB = G.Core.GConvert.ToBool(itemobj.IsAttributeB);
                dtl.ISATTRIBUTEC = G.Core.GConvert.ToBool(itemobj.IsAttributeC);

                shopsupply.SHOPSUPPLYDTL.Add(dtl);
                //弹出外协领料单,数据来自选择行
                Storage.SM_SHOPSUPPLYEDIT edit = new Storage.SM_SHOPSUPPLYEDIT();
                edit.CurEditStatus = EditorStatus.Modify;
                edit.SetData(shopsupply);
                edit.ShowDialog();

                this.LoadGridCP(orderid, gxname);
                this.LoadGridShop(orderid, gxname);
                this.LoadGridZJ(orderid, gxname);
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }
        }
Exemplo n.º 3
0
        private void DownPlan()
        {
            try
            {
                if (gxname == "")
                {
                    MessageBox.Show("没有选择工序,无法生产下达!");
                    return;
                }
                List <SM_BOMTEMP> tempdata = new List <SM_BOMTEMP>();
                G.BLL.ERP.BaseData.DM_ITEMLogic itemlogic = new G.BLL.ERP.BaseData.DM_ITEMLogic();
                if (tabControl1.SelectedIndex == 0)
                {
                    this.Grid_CP.FinishEditing();
                    tempdata = (this.Grid_CP.DataSource as BindingList <SM_BOMTEMP>).ToList <SM_BOMTEMP>();
                }
                else
                {
                    this.Grid_ZJ.FinishEditing();
                    tempdata = (this.Grid_ZJ.DataSource as BindingList <SM_BOMTEMP>).ToList <SM_BOMTEMP>();
                }
                var updata = from temp in tempdata
                             where temp.ISSELECT == true
                             select temp;
                List <SM_SHOPORDER> listshoporder = new List <SM_SHOPORDER>();
                bool nopass = true;
                foreach (SM_BOMTEMP t in updata)
                {
                    if (t.RDATE == null || t.LEFTQTY <= 0)
                    {
                        nopass = false; break;
                    }
                    SM_SHOPORDER shopo = new SM_SHOPORDER();
                    shopo.ORDERID    = t.ORDERID;
                    shopo.BOMTEMPID  = t.Id;
                    shopo.ITEMCODE   = t.ITEMCODE;
                    shopo.ATTRIBUTEA = t.ATTRIBUTEA;
                    shopo.ATTRIBUTEB = t.ATTRIBUTEB;
                    shopo.ATTRIBUTEC = t.ATTRIBUTEC;
                    shopo.REQQTY     = t.LEFTQTY;
                    shopo.RDATE      = t.RDATE;
                    shopo.SHPORDTYPE = "1";
                    shopo.STATUS     = "N";
                    shopo.MEMO       = t.MEMO;
                    shopo.ATTRIBUTED = t.ATTRIBUTED;
                    shopo.WORKSHOP   = gxname;
                    listshoporder.Add(shopo);
                }
                if (nopass)
                {
                    DbEntry.UsingTransaction(delegate
                    {
                        shoplogic.ExecuteUpdate(G.AppInfo.GGlobal.User, listshoporder);
                        //((SM_BOMTEMPLogic)this.Logic).ExecuteUpdate(G.AppInfo.GGlobal.User, updata.ToList<SM_BOMTEMP>());
                    });
                }
                else
                {
                    MessageBox.Show("请确定需要下达的行有【下达日期】和【计划数量】!");
                }


                this.LoadGridCP(orderid, gxname);
                this.LoadGridShop(orderid, gxname);
                this.LoadGridZJ(orderid, gxname);
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }
        }
Exemplo n.º 4
0
        private void ShopSupply()
        {
            try
            {
                this.gGrid1.FinishEditing();
                List <SM_BOMTEMP> tempdata = (this.gGrid1.DataSource as BindingList <SM_BOMTEMP>).ToList <SM_BOMTEMP>();

                var updata = from temp in tempdata
                             where temp.ISSELECT == true
                             select temp;
                SM_SHOPSUPPLY shopsupply = new SM_SHOPSUPPLY();
                G.BLL.Sys.ND_ORGINAZITIONLogic orglogic = new G.BLL.Sys.ND_ORGINAZITIONLogic();
                ND_ORGINAZITION orgobj = orglogic.ExecuteSelect(CK.K["ID"].Eq(G.AppInfo.GGlobal.User.ORGID), OrderBy.Parse("ID"), 0, 0)[0];
                shopsupply.APPLYER     = G.AppInfo.GGlobal.User.USERDM;
                shopsupply.APPLYERNAME = G.AppInfo.GGlobal.User.USERNAME;
                shopsupply.APPLYDATE   = G.Core.GConvert.ToDateTime(System.Time.Now);
                shopsupply.WORKSHOP    = orgobj.ORGDM;
                shopsupply.ORGNAME     = orgobj.ORGNAME;
                bool nopass = true;
                foreach (SM_BOMTEMP t in updata)
                {
                    if (t.ONHANDQTY == 0 || t.UNASSISTQTY <= 0)
                    {
                        nopass = false; break;
                    }
                    SM_SHOPSUPPLYDTL shopsupplydtl            = new SM_SHOPSUPPLYDTL();
                    G.BLL.ERP.BaseData.DM_ITEMLogic itemlogic = new G.BLL.ERP.BaseData.DM_ITEMLogic();
                    DM_ITEM itemobj = itemlogic.ExecuteSelect(CK.K["ITEMCODE"].Eq(t.ITEMCODE), OrderBy.Parse("ITEMCODE"), 0, 0)[0];
                    shopsupplydtl.BOMTEMPID      = t.Id;
                    shopsupplydtl.ITEMCODE       = t.ITEMCODE;
                    shopsupplydtl.ITEMNAME       = t.ITEMNAME;
                    shopsupplydtl.UNIT           = t.INVUNIT;
                    shopsupplydtl.ATTRIBUTEA     = t.ATTRIBUTEA;
                    shopsupplydtl.ATTRIBUTEB     = t.ATTRIBUTEB;
                    shopsupplydtl.ATTRIBUTEBNAME = t.ATTRIBUTEBNAME;
                    shopsupplydtl.ATTRIBUTEC     = t.ATTRIBUTEC;
                    shopsupplydtl.MEMO           = t.MEMO;
                    shopsupplydtl.ATTRIBUTED     = t.ATTRIBUTED;
                    shopsupplydtl.WRHSCODE       = t.WRHSCODE;
                    shopsupplydtl.WRHSNAME       = t.WRHSNAME;
                    shopsupplydtl.LOCCODE        = t.LOCCODE;
                    shopsupplydtl.LOCNAME        = t.LOCNAME;
                    shopsupplydtl.ISATTRIBUTEA   = G.Core.GConvert.ToBool(itemobj.IsAttributeA);
                    shopsupplydtl.ISATTRIBUTEB   = G.Core.GConvert.ToBool(itemobj.IsAttributeB);
                    shopsupplydtl.ISATTRIBUTEC   = G.Core.GConvert.ToBool(itemobj.IsAttributeC);
                    if (t.UNASSISTQTY <= t.ONHANDQTY)
                    {
                        shopsupplydtl.ACTQTY = t.UNASSISTQTY;
                    }
                    else
                    {
                        shopsupplydtl.ACTQTY = t.ONHANDQTY;
                    }
                    shopsupply.SHOPSUPPLYDTL.Add(shopsupplydtl);
                }
                //弹出成品领料单,数据来自选择行
                G.Erp.Storage.SM_SHOPSUPPLYEDIT shopsupplyEdit = new G.Erp.Storage.SM_SHOPSUPPLYEDIT();
                shopsupplyEdit.CurEditStatus = EditorStatus.Modify;
                shopsupplyEdit.SetData(shopsupply);
                shopsupplyEdit.ShowDialog();
                //成品领料数量填入BOMTEMP
                foreach (SM_BOMTEMP t in updata)
                {
                    if (t.UNASSISTQTY <= t.ONHANDQTY)
                    {
                        t.STOCKQTY = G.Core.GConvert.ToDecimal(t.STOCKQTY) + t.UNASSISTQTY;
                    }
                    else
                    {
                        t.STOCKQTY = G.Core.GConvert.ToDecimal(t.STOCKQTY) + t.ONHANDQTY;
                    }
                    ((SM_BOMTEMPLogic)this.Logic).ExecuteUpdate(G.AppInfo.GGlobal.User, tempdata);
                }
                this.Refresh();
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }
        }