示例#1
0
 /// <summary>
 /// 由于按订单出库,因此单独有表记录订单出库数量
 /// </summary>
 /// <param name="obr"></param>
 public void InsertOutBoundRecord(OutBoundRecord obr)
 {
     using (var dbContext = new StoreDbContext())
     {
         dbContext.Insert <OutBoundRecord>(obr);
     }
 }
        public ActionResult Create(FormCollection collection)
        {
            if (collection.AllKeys.Contains("DictionaryProperty.dpid"))
            {
                StoreTableRequest request = new StoreTableRequest();
                request.PageSize = 1000;
                request.Gid      = new Guid(collection["DictionaryProperty.dpid"]);
                int OutProductNumber;
                if (!int.TryParse(collection["OutBoundCount"], out OutProductNumber))
                {
                    var model = new StoreTable();
                    return(View("OutBoundEdit", model));
                }
                //OutProductNumber = int.Parse(collection["OutBoundCount"]); //出库订单件数
                var  result = this.StoreService.GetStoreList(request);
                Guid tempid = new Guid();
                foreach (StoreTable st in result)
                {
                    if (st.DictionaryProperty.leaf_id == request.Gid)
                    {
                        st.number = st.number - (st.DictionaryProperty.js.Value * Convert.ToDecimal(OutProductNumber));
                        InBoundRecord ibr = new InBoundRecord();
                        //插入数据到入库记录表
                        ibr.inbound_id = st.store_item_id;
                        ibr.rkid       = Guid.NewGuid();
                        ibr.number     = st.number;
                        ibr.boundtype  = "出库材料";
                        ibr.khmc       = this.StoreService.GetParentNameByLeafID(st.DictionaryProperty.leaf_id.Value);
                        this.StoreService.InsertInboundRecord(ibr);

                        tempid = st.DictionaryProperty.leaf_id.Value;
                        //出库
                        this.StoreService.OutBoundItem(st);
                    }
                }
                //插入到出库记录表
                OutBoundRecord obr = new OutBoundRecord();
                obr.ckid    = Guid.NewGuid();
                obr.node_id = tempid;
                obr.number  = OutProductNumber;
                this.StoreService.InsertOutBoundRecord(obr);
            }
            return(this.RefreshParent());
        }
示例#3
0
        public ActionResult Create(FormCollection collection)
        {
            if (collection.AllKeys.Contains("DictionaryProperty.dpid"))
            {
                StoreTableRequest request = new StoreTableRequest();
                request.PageSize = 10000;
                request.Gid      = new Guid(collection["DictionaryProperty.dpid"]);
                int OutProductNumber;
                if (!int.TryParse(collection["OutBoundCount"], out OutProductNumber))
                {
                    var model = new StoreTable();
                    return(View("OutBoundEdit", model));
                }
                var lydw = collection["employment"];
                ///
                var  result = this.StoreService.GetStoreList(request);
                Guid tempid = new Guid();//订单ID,出库记录表用
                //获取订单下所有材料
                StoreTreeNameRequests stnRequest = new StoreTreeNameRequests();
                stnRequest.PageSize = 1000;
                stnRequest.treeID   = request.Gid;
                var dpLists = this.StoreService.GetNodeProperty(stnRequest);
                foreach (DictionaryProperty dp in dpLists)
                {
                    var storeItem = this.StoreService.ExistDPInStore(dp);
                    tempid = dp.leaf_id.Value;
                    //判断store里是否有dp
                    if (storeItem == null)
                    {
                        StoreTable st = new StoreTable();
                        st.number        = 0;
                        st.number        = st.number - (dp.js.Value * Convert.ToDecimal(OutProductNumber));
                        st.store_item_id = dp.dpid;

                        InBoundRecord ibr = new InBoundRecord();
                        //插入数据到入库记录表
                        ibr.inbound_id = st.store_item_id;
                        ibr.rkid       = Guid.NewGuid();
                        ibr.number     = dp.js.Value * Convert.ToDecimal(OutProductNumber);
                        ibr.boundtype  = "出库材料";
                        ibr.employment = lydw;
                        ibr.khmc       = this.StoreService.GetParentNameByLeafID(dp.leaf_id.Value);
                        this.StoreService.InsertInboundRecord(ibr);

                        //出库
                        this.StoreService.InsertStoreItem(st);
                    }
                    else//有StoreItem
                    {
                        storeItem.number = storeItem.number - (dp.js.Value * Convert.ToDecimal(OutProductNumber));

                        InBoundRecord ibr = new InBoundRecord();
                        //插入数据到入库记录表
                        ibr.inbound_id = storeItem.store_item_id;
                        ibr.rkid       = Guid.NewGuid();
                        ibr.number     = dp.js.Value * Convert.ToDecimal(OutProductNumber);
                        ibr.boundtype  = "出库材料";
                        ibr.employment = lydw;
                        ibr.khmc       = this.StoreService.GetParentNameByLeafID(storeItem.DictionaryProperty.leaf_id.Value);
                        this.StoreService.InsertInboundRecord(ibr);

                        //出库
                        this.StoreService.OutBoundItem(storeItem);
                    }
                    //
                }
                //插入到出库记录表
                OutBoundRecord obr = new OutBoundRecord();
                obr.ckid       = Guid.NewGuid();
                obr.node_id    = tempid;
                obr.employment = lydw;
                obr.number     = OutProductNumber;
                this.StoreService.InsertOutBoundRecord(obr);
            }
            return(this.RefreshParent());
        }