Beispiel #1
0
        /// <summary>
        /// 生成应付单
        /// </summary>
        /// <param name="ctx"></param>
        /// <param name="souObj"></param>
        /// <returns></returns>
        private static IOperationResult ToTransferSalseBill(Context ctx, DynamicObject souObj,string billtype)
        {
            IOperationResult convertResult = new OperationResult();
            DynamicObjectCollection dyCollection = souObj["PUR_ReceiveEntry"] as DynamicObjectCollection;

          

            List<ListSelectedRow> ListSalReSelect = new List<ListSelectedRow>();
            dyCollection.ToList().ForEach(entiyItem =>
            {
                ListSelectedRow convertItem = new ListSelectedRow(
                       Convert.ToString(souObj["Id"]),
                       Convert.ToString(entiyItem["Id"]),
                       Convert.ToInt32(entiyItem["Seq"]),
                       "PUR_ReceiveBill");
                ListSalReSelect.Add(convertItem); 
            });

            if (ListSalReSelect.Count <= 0)
            {
                return convertResult;
            }
            BillConvertOption convertOption = new BillConvertOption();
            convertOption.sourceFormId = "PUR_ReceiveBill";
            convertOption.targetFormId = "AP_Payable";
            convertOption.ConvertRuleKey = "AP_ReceiveToPayableMap";
            convertOption.Option = OperateOption.Create();
            convertOption.Option.SetIgnoreWarning(false);
            convertOption.BizSelectRows = ListSalReSelect.ToArray();
            convertOption.IsDraft = false;
            convertOption.IsSave = true;
            convertOption.IsAudit = true;
            convertResult = ConvertBills(ctx, convertOption,billtype);
            return convertResult;
        }
Beispiel #2
0
        /// <summary>
        /// 即时库存汇总数据查询--增加单位酶活量,标吨
        /// </summary>
        /// <param name="ctx"></param>
        /// <returns></returns>
        public List <DynamicObject> GetInvSumQueryAllData(Context ctx)
        {
            List <DynamicObject> obj     = new List <DynamicObject>();
            string strSql                = @"select t1.FID,t1.FQty,t1.FBASEQTY,t1.FSecQty,t2.FJNTONPROPERTY,t2.FIsMeasure 
                              from T_STK_INVSUMQUERY t1
                              join T_BD_MATERIAL t2 on t1.FMATERIALID=t2.FMATERIALID ";
            DynamicObjectCollection data = DBUtils.ExecuteDynamicObject(ctx, strSql);

            if (data != null)
            {
                obj = data.ToList();
            }
            return(obj);
        }
Beispiel #3
0
        /// <summary>
        /// 关联物料相关信息
        /// </summary>
        /// <param name="ctx"></param>
        /// <param name="objects"></param>
        /// <returns></returns>
        private List <DynamicObject> GetObjects(Context ctx, List <DynamicObject> objects)
        {
            if (objects != null && objects.Count > 0)
            {
                List <string> listIds = objects.Select(o => SQLUtils.GetFieldValue(o, "Number")).ToList();

                string sql = string.Format(@"select a.FNumber,a.FForbidStatus,u.FNUMBER as FCATEGORYID
                                            ,b.FName,p.FNUMBER as FSaleUnitId,b.FSpecification,h.FNAME,F_HS_ProductSKU,q.F_HS_SKUGroupCode,F_HS_Specification1,F_HS_Specification2,j.FNumber F_HS_BrandNumber,r.FNAME F_HS_BrandName,
											n.FNumber F_HS_PRODUCTSTATUS,k.FNumber F_HS_ListID,l.FName F_HS_ListName,c.FGROSSWEIGHT,a.F_HS_ProductLimitState,a.F_HS_BatteryMod,a.F_HS_IsPuHuo,
											a.F_HS_IsOil,a.F_HS_ExtraPercentage,a.F_HS_ExtraCommissionCountry,a.F_HS_BasePrice,a.F_HS_BasePriceCountry,a.F_HS_FreeMailMod,a.F_HS_IsOnSale,a.F_HS_IntegralReturnRate      
                                            from T_BD_MATERIAL a 
                                            inner join T_BD_MATERIAL_L b on b.FMATERIALID = a.FMATERIALID and b.FLOCALEID=2052
                                            inner join T_BD_MATERIALBASE c on c.FMATERIALID = a.FMATERIALID 
                                            inner join T_BD_MATERIALSALE d on d.FMATERIALID = a.FMATERIALID
                                            inner join T_BD_MATERIALSTOCK e on e.FMATERIALID = a.FMATERIALID
                                            inner join T_ORG_ORGANIZATIONS f on a.FUSEORGID=f.FORGID
                                            left join T_BD_unit_L h on d.FSaleUnitId =h.FUNITID and h.FLOCALEID=2052
											inner join HS_T_Brand j on j.FID = a.F_HS_Brand
											inner join HS_T_BRAND_L r on r.FID = j.FID
											inner join HS_T_BD_LISTID k on k.FID = a.F_HS_ListIDNew
											inner join HS_T_BD_LISTID_L l on l.FID = k.FID
											inner join T_BAS_ASSISTANTDATAENTRY_L m ON a.F_HS_PRODUCTSTATUS=m.FENTRYID
                                            inner join T_BAS_ASSISTANTDATAENTRY n ON m.FentryID=n.FentryID
											inner join T_BD_MATERIALSALE o on a.FMATERIALID=o.FMATERIALID 
                                            inner join T_BD_UNIT p on o.FSALEUNITID=p.FUNITID
                                            inner join T_BD_MATERIALGROUP q on q.FID = a.FMaterialGroup
                                            inner join  T_BD_MATERIALCATEGORY u on u.FCATEGORYID = c.FCATEGORYID
                                            where f.FNUMBER='100' 
											and a.FNUMBER not like '99.%'
                                            and a.FNumber <> 'SPXJ'
											and k.FNUMBER in('{0}')
                                            and u.FNUMBER = '{1}'", string.Join("','", listIds), "CHLB08_SYS");


                DynamicObjectCollection coll = SQLUtils.GetObjects(ctx, sql);

                if (coll != null && coll.Count > 0)
                {
                    return(coll.ToList());
                }
            }

            return(null);
        }
        /// <summary>
        /// 获取内蒙出库的数量,批号
        /// </summary>
        /// <param name="poEntryIds"></param>
        /// <returns></returns>
        protected List <DynamicObject> GetOutStockData(List <long> poEntryIds)
        {
            List <DynamicObject> lst = new List <DynamicObject>();
            string strSql            = string.Format(@"SELECT t6.FID,t6.FSEQ,t1.FENTRYID,t6.FLOT_TEXT,t6.FREALQTY,t6.FUNITID,t6.FJNUnitEnzymes,t6.FAuxUnitQty
                                            FROM T_PUR_POORDERENTRY t1
                                            JOIN T_SAL_ORDERENTRY_LK t2 ON t1.FENTRYID=t2.FSID AND t1.FID=t2.FSBILLID
                                            JOIN T_SAL_ORDERENTRY t3 ON t2.FENTRYID=t3.FENTRYID
                                            JOIN T_SAL_ORDER t4 ON t3.FID=t4.FID
                                            JOIN T_SAL_OUTSTOCKENTRY_R t5 ON t4.FBILLNO=t5.FSOORDERNO AND t3.FENTRYID=t5.FSOENTRYID
                                            JOIN T_SAL_OUTSTOCKENTRY t6 ON t5.FENTRYID=t6.FENTRYID
                                            WHERE t1.FENTRYID in ({0})
                                            ORDER BY t6.FID,t6.FSEQ
                                            ", string.Join(",", poEntryIds));

            DynamicObjectCollection dt = DBUtils.ExecuteDynamicObject(this.Context, strSql);

            if (dt != null)
            {
                lst = dt.ToList();
            }
            return(lst);
        }