Ejemplo n.º 1
0
 public DataTable QurayArrived(string code)
 {
     using (BaseAccess access = new BaseAccess())
     {
         string    strSQL = string.Format("SELECT T1.ccode 到货单号,T1.dDate 单据日期,T2.cvenname 供应商名称, B.cComunitCode 供应商代码,B.cInvStd 规格, B.cinvcode 物料编码,B.cinvname 物料名称,A.iquantity 采购数量,C.cComUnitName 单位,A.cbatch 批号,A.iNum 到货数量 FROM  pu_arrivalVouchs A, inventory B,ComputationUnit C,PU_ArrivalVouch T1,vendor T2 WHERE A.cInvCode = B.cinvcode and B.cComunitCode = C.cComunitCode and T1.ID = A.ID and T1.cvencode=T2.cvencode and T1.ccode='{0}'", code);
         DataTable table  = access.ExcuteTable(strSQL);
         foreach (DataRow row in table.Rows)
         {
             row["到货数量"] = row["采购数量"];
         }
         return(table);
     }
 }
Ejemplo n.º 2
0
        public DataTable GetOutStoreMessage()
        {
            List <InStoreDetails> list  = new List <InStoreDetails>();
            DataTable             table = null;

            using (BaseAccess access = new BaseAccess())
            {
                string strSQL = "select distinct c.invcode 子件编码, a.mocode 订单号,d.cinvname 子件名称,d.cinvstd 子件规格, d.cInvDefine4 as 批次,e.ccomunitname 计量单位,sum(c.baseqtyN)as 基本用量,sum(c.qty)as 应领数量,d.cInvDefine4 as 库位,d.cInvDefine4 as 缺料量 from mom_order a,mom_orderdetail b, mom_moallocate c,INVENTORY d,computationunit e where a.moid=b.moid and b.modid=c.modid and c.invcode=d.cinvcode and d.ccomunitcode=e.ccomunitcode and a.MoCode ='A0000022373' group by c.invcode,a.mocode,d.cinvname,d.cinvstd,e.ccomunitname,d.iDrawBatch,d.cInvDefine4";
                table = access.ExcuteTable(strSQL);
            }
            using (StoreAccess access = new StoreAccess())
            {
                foreach (DataRow item in table.Rows)
                {
                    string strSQL = string.Format("SELECT * FROM [Table_InStoreDetails] WHERE [MaterialCode]= '{0}' ORDER BY Time ASC ", item["子件编码"]);
                    list = access.Select <InStoreDetails>(strSQL).Where(o => o.Count >= (decimal)item["应领数量"]).ToList <InStoreDetails>();
                    if (list.Count >= 1)
                    {
                        item["库位"]  = list[0].VirifyCode;
                        item["批次"]  = list[0].Batch;
                        item["缺料量"] = 0;
                    }
                    else
                    {
                        list = access.Select <InStoreDetails>(strSQL);
                        if (list.Count == 1)
                        {
                            item["库位"]  = list[0].VirifyCode;
                            item["批次"]  = list[0].Batch;
                            item["缺料量"] = (decimal)item["应领数量"] - list[0].Count;
                        }
                        else
                        {
                            for (int i = 0; i < list.Count; i++)
                            {
                                if (list[i].Count++ <= (decimal)item["应领数量"])
                                {
                                    item["库位"] += string.Concat(list[i].VirifyCode, ",");
                                    item["批次"] += string.Concat(list[i].Batch, ",");
                                }
                                else
                                {
                                    break;
                                }
                            }
                        }
                    }
                }
            }
            return(table);
        }