Example #1
0
        /// <summary>
        /// 向数据库插入印章信息
        /// </summary>
        /// <param name="seal">印章信息表</param>
        /// <param name="ars">TheOrder订单表</param>
        /// <returns></returns>
        public async Task <int> CreateSealList(string seal, string ars)
        {
            string guid = Guid.NewGuid().ToString();
            int    id   = await BLL.SealInforNewBLL.GetMaxId();

            List <Models.SealInforNew1> s1 = JsonConvert.DeserializeObject <List <Models.SealInforNew1> >(seal);

            Models.SealInforNew2 s2 = JsonConvert.DeserializeObject <Models.SealInforNew2>(ars);

            SealSystem.Models.SealInforNew list   = new SealInforNew();
            SealSystem.Models.TheOrder     listss = new TheOrder();//订单
            foreach (Models.SealInforNew1 item in s1)
            {
                try
                {
                    list.EngravingLevel                 = item.EngravingLevel;
                    list.EngravingType                  = item.EngravingType;
                    list.Note                           = item.Note;
                    list.RegistrationCategory           = item.RegistrationCategory;
                    list.SealCategory_Id_Code           = BLL.SealCategoriesBLL.GetSelected(item.SealCategory_Id_Code, item.SealSpecification);
                    list.SealContent                    = item.SealContent;
                    list.SealInforNum                   = (1201160000000 + id++).ToString(); /*item.SealInforNum;*///印章编码
                    list.SealMaterial                   = item.SealMaterial;
                    list.SealShape                      = item.SealShape;
                    list.SealState                      = "已录入";
                    list.TheOrders_TheOrderCode         = guid;
                    list.SealUseUnitInfor_Id_UnitNumber = await BLL.SealUseUnitInforBLL.GetOneForId(s2.SealUseUnitInfor_Id_UnitNumber);

                    await BLL.SealInforNewBLL.AddAsync(list);//增加一条印章信息
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
            //添加订单信息
            listss.ForTheRecordType = s2.ForTheRecordType;
            //listss.SealInforNum = item.SealInforNum;
            listss.SealMakingUnitInfor_Name = s2.SealMakingUnitInfor_Name;
            listss.TheRegistrationArea      = s2.TheRegistrationArea;
            listss.TheOrderCode             = guid;
            listss.SealState = "待交付";
            await BLL.TheOrderBLL.Add(listss);

            return(listss.Id);
        }
Example #2
0
    private void HuScan(Hu hu)
    {
        if (hu == null)
        {
            this.lblMessage.Text = Resources.Language.MasterDataHuNotExist;
            return;
        }
        else
        {
            if (TheOrder.OrderDetails != null)
            {
                foreach (OrderDetail orderDetail in TheOrder.OrderDetails)
                {
                    if (orderDetail.HuId == hu.HuId)
                    {
                        this.lblMessage.Text = Resources.Language.MasterDataHuExist;
                        return;
                    }
                }
            }
            Flow flow = this.TheFlowMgr.LoadFlow(TheOrder.Flow);
            if (flow != null && !flow.AllowCreateDetail)
            {
                bool isMatch = false;
                if (TheOrder.OrderDetails != null)
                {
                    foreach (OrderDetail orderDetail in TheOrder.OrderDetails)
                    {
                        if (orderDetail.Item.Code == hu.Item.Code && orderDetail.Uom.Code == hu.Uom.Code)
                        {
                            if (!orderDetail.OrderHead.FulfillUnitCount || orderDetail.UnitCount == hu.UnitCount)
                            {
                                if (orderDetail.HuId != string.Empty && orderDetail.HuId != null)
                                {
                                    OrderDetail newOrderDetail = new OrderDetail();
                                    newOrderDetail.IsScanHu = true;
                                    int seqInterval = int.Parse(TheEntityPreferenceMgr.LoadEntityPreference(BusinessConstants.ENTITY_PREFERENCE_CODE_SEQ_INTERVAL).Value);

                                    int seq = int.Parse(TheEntityPreferenceMgr.LoadEntityPreference(BusinessConstants.ENTITY_PREFERENCE_CODE_SEQ_INTERVAL).Value);
                                    if (this.TheOrder.OrderDetails == null || this.TheOrder.OrderDetails.Count == 0)
                                    {
                                        newOrderDetail.Sequence = seqInterval;
                                    }
                                    else
                                    {
                                        newOrderDetail.Sequence = this.TheOrder.OrderDetails.Last <OrderDetail>().Sequence + seqInterval;
                                    }
                                    newOrderDetail.Item  = orderDetail.Item;
                                    newOrderDetail.Uom   = orderDetail.Uom;
                                    newOrderDetail.HuId  = hu.HuId;
                                    newOrderDetail.HuQty = hu.Qty;
                                    if ((this.ModuleType == BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_PRODUCTION && this.ModuleSubType == BusinessConstants.CODE_MASTER_ORDER_SUB_TYPE_VALUE_ADJ) ||
                                        this.ModuleSubType == BusinessConstants.CODE_MASTER_ORDER_SUB_TYPE_VALUE_RTN)
                                    {
                                        newOrderDetail.OrderedQty = -hu.Qty;
                                    }
                                    else
                                    {
                                        newOrderDetail.OrderedQty = hu.Qty;
                                    }
                                    newOrderDetail.LocationFrom = orderDetail.LocationFrom;
                                    if (this.IsReject)
                                    {
                                        newOrderDetail.LocationTo = TheLocationMgr.GetRejectLocation();
                                    }
                                    else
                                    {
                                        newOrderDetail.LocationTo = orderDetail.LocationTo;
                                    }
                                    newOrderDetail.ReferenceItemCode = orderDetail.ReferenceItemCode;
                                    newOrderDetail.UnitCount         = orderDetail.UnitCount;
                                    newOrderDetail.PackageType       = orderDetail.PackageType;
                                    newOrderDetail.OrderHead         = orderDetail.OrderHead;
                                    newOrderDetail.IsScanHu          = true;
                                    TheOrder.AddOrderDetail(newOrderDetail);
                                }

                                else
                                {
                                    orderDetail.IsScanHu = true;
                                    orderDetail.HuId     = hu.HuId;
                                    orderDetail.HuQty    = hu.Qty;
                                    if ((this.ModuleType == BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_PRODUCTION && this.ModuleSubType == BusinessConstants.CODE_MASTER_ORDER_SUB_TYPE_VALUE_ADJ) ||
                                        this.ModuleSubType == BusinessConstants.CODE_MASTER_ORDER_SUB_TYPE_VALUE_RTN)
                                    {
                                        orderDetail.OrderedQty = -hu.Qty;
                                    }
                                    else
                                    {
                                        orderDetail.OrderedQty = hu.Qty;
                                    }
                                    if (this.IsReject)
                                    {
                                        orderDetail.LocationTo = TheLocationMgr.GetRejectLocation();
                                    }
                                }
                                isMatch = true;
                                break;
                            }
                        }
                    }
                }
                if (!isMatch)
                {
                    this.lblMessage.Text = Resources.Language.MasterDataFlowNotExistHuItem;
                    return;
                }
            }
            else
            {
                OrderDetail newOrderDetail = new OrderDetail();
                newOrderDetail.IsScanHu = true;
                int seqInterval = int.Parse(TheEntityPreferenceMgr.LoadEntityPreference(BusinessConstants.ENTITY_PREFERENCE_CODE_SEQ_INTERVAL).Value);

                int seq = int.Parse(TheEntityPreferenceMgr.LoadEntityPreference(BusinessConstants.ENTITY_PREFERENCE_CODE_SEQ_INTERVAL).Value);
                if (this.TheOrder.OrderDetails == null || this.TheOrder.OrderDetails.Count == 0)
                {
                    newOrderDetail.Sequence = seqInterval;
                }
                else
                {
                    newOrderDetail.Sequence = this.TheOrder.OrderDetails.Last <OrderDetail>().Sequence + seqInterval;
                }
                newOrderDetail.Item  = hu.Item;
                newOrderDetail.Uom   = hu.Uom;
                newOrderDetail.HuId  = hu.HuId;
                newOrderDetail.HuQty = hu.Qty;
                if ((this.ModuleType == BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_PRODUCTION && this.ModuleSubType == BusinessConstants.CODE_MASTER_ORDER_SUB_TYPE_VALUE_ADJ) ||
                    this.ModuleSubType == BusinessConstants.CODE_MASTER_ORDER_SUB_TYPE_VALUE_RTN)
                {
                    newOrderDetail.OrderedQty = -hu.Qty;
                }
                else
                {
                    newOrderDetail.OrderedQty = hu.Qty;
                }
                if (this.IsReject)
                {
                    newOrderDetail.LocationFrom = TheLocationMgr.GetRejectLocation();
                }
                else
                {
                    newOrderDetail.LocationFrom = TheOrder.LocationFrom;
                }
                newOrderDetail.LocationTo = TheOrder.LocationTo;
                newOrderDetail.UnitCount  = hu.UnitCount;
                TheOrder.AddOrderDetail(newOrderDetail);
            }

            IList <OrderDetail> orderDetailList = new List <OrderDetail>();
            foreach (OrderDetail od in TheOrder.OrderDetails)
            {
                if (od.IsScanHu)
                {
                    orderDetailList.Add(od);
                }
            }

            this.GV_List.DataSource = orderDetailList;
            this.GV_List.DataBind();
            InitialHuScan();
        }
    }