Exemple #1
0
        private void LoadOrg()
        {
            int totalRowCount = 0;

            treeView_menu.Nodes.Clear();

            List <ND_ORGINAZITION> list = orglogic.ExecuteSelect(Condition.Empty, OrderBy.Parse("id"), 0, 1, ref totalRowCount);
            TreeNode node = new TreeNode();

            node.Text = "部门";
            this.treeView_menu.Nodes.Add(node);
            FillTree(node, list, -1);
            this.treeView_menu.Nodes[0].Expand();
        }
Exemple #2
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);
            }
        }