示例#1
0
文件: BillBean.cs 项目: cjllove/ERP
        /// <summary>
        /// 测试调用方法
        /// </summary>
        /// <returns></returns>
        public static String execTest()
        {
            BillBean bb = new BillBean();

            bb.bizDate      = DateTime.Now;
            bb.adminOrgUnit = new BillObject("123");
            bb.number       = "456";
            BillEntryToken bet = new BillEntryToken();

            bet.material = new BillObject("789");
            bet.qty      = 10;
            bb.entry.Add(bet);

            BillBeanList bbl = new BillBeanList();

            bbl.Add(bb);
            String result = JsonConvert.SerializeObject(bbl);

            return(result);
        }
示例#2
0
文件: BillBean.cs 项目: cjllove/ERP
        /// <summary>
        /// 其他出库单
        /// </summary>
        /// <returns>返回结果json string</returns>
        public String renderQT()
        {
            //初始化
            init();

            //TODO 查找未上传的出库单
            //TODO 拼入参
            //TODO 调用接口方法,获取返回值
            //TODO 处理返回值
            //查找未上传的出库单
            string    sql_ck = @"select * from dat_ck_doc c,doc_customer t where c.custid=t.code and t.settlementway='NZJ' and c.flag = 'G' and c.issend='N' and nvl(c.num2,0)=0
                              union
                              select * from dat_ck_doc c,doc_customer t where c.custid=t.code and c.num2=2 and c.flag = 'G' and c.issend='N'";
            DataTable dt     = DbHelperOra.Query(sql_ck).Tables[0];

            if (dt != null && dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    #region 拼表头
                    BillBean ck      = new BillBean();
                    String   seqno   = dr["SEQNO"].ToString();
                    DateTime bizDate = Convert.ToDateTime(dr["SHRQ"]);

                    ck.bizDate = bizDate;
                    String    customerSql       = "select CODE EASCODE,COSTCENTER,USERCODE,WAREHOUSE,SALEPERSON,STORAGEUNIT,COMPANYUNIT,STOCKER,DCBM,DRBM,XSZ,SALEBM from doc_customer where code = '" + dr["CUSTID"].ToString() + "'";
                    DataTable customerInfo      = DbHelperOra.Query(customerSql).Tables[0];
                    String    custId            = customerInfo.Rows[0]["EASCODE"].ToString();
                    String    creator           = customerInfo.Rows[0]["USERCODE"].ToString();
                    String    stocker           = customerInfo.Rows[0]["STOCKER"].ToString();
                    String    salePerson        = customerInfo.Rows[0]["SALEPERSON"].ToString();
                    String    storOrgUnit       = customerInfo.Rows[0]["STORAGEUNIT"].ToString();
                    String    costCenterOrgUnit = customerInfo.Rows[0]["COSTCENTER"].ToString();
                    String    wareHouse         = customerInfo.Rows[0]["WAREHOUSE"].ToString();
                    String    companyUnit       = customerInfo.Rows[0]["COMPANYUNIT"].ToString();

                    ck.number       = seqno + "_" + custId;
                    ck.adminOrgUnit = new BillObject(companyUnit);
                    ck.creator      = new BillObject(creator);
                    //ck.materialReqestPerson = new BillObject(salePerson);
                    ck.storageOrgUnit    = new BillObject(storOrgUnit);
                    ck.transactionType   = new BillObject(856);
                    ck.stocker           = new BillObject(stocker);
                    ck.costCenterOrgUnit = new BillObject(costCenterOrgUnit);
                    ck.issueType         = new BillObject("YXJY001");
                    ck.createTime        = DateTime.Now;
                    ck.description       = dr["MEMO"].ToString();
                    String    sql     = "select * from dat_ck_com where seqno = '" + seqno + "' and custid = '" + dr["CUSTID"].ToString() + "'";
                    DataTable dResult = DbHelperOra.Query(sql).Tables[0];
                    #endregion

                    #region 拼表体
                    Boolean canContinue = true;
                    foreach (DataRow comdr in dResult.Rows)
                    {
                        BillEntryToken bet      = new BillEntryToken();
                        String         easGDSEQ = getEasGDSEQ(comdr["GDSEQ"].ToString());
                        String         unit     = comdr["UNIT"].ToString();
                        if (easGDSEQ == null)
                        {
                            canContinue       = false;
                            this.errorDetail += "订单[" + comdr["SEQNO"].ToString() + "]中的商品[" + comdr["GDSEQ"].ToString() + "] 不是 EAS 商品. ";
                            UpdateBill(comdr["SEQNO"].ToString(), "E", dr["CUSTID"].ToString(), "DAT_CK_DOC");
                            break;
                        }
                        Decimal qty = Convert.ToDecimal(comdr["XSSL"]);
                        bet.qty       = qty;
                        bet.remark    = comdr["MEMO"].ToString();
                        bet.customer  = new BillObject(custId);
                        bet.material  = new BillObject(easGDSEQ);
                        bet.warehouse = new BillObject(wareHouse);
                        //bet.storeStatus = new BillObject(custId);
                        bet.stocker = new BillObject(stocker);
                        //bet.storeType = bet.deliveryCustomer;
                        bet.unit = new BillObject(unit);
                        bet.lot  = comdr["PH"].ToString();
                        ck.entry.Add(bet);
                    }
                    #endregion

                    if (canContinue)
                    {
                        billBeanList.Add(ck);
                    }
                }
                this.resultDT = dt;
            }
            if (billBeanList.Count <= 0)
            {
                this.errorDetail += "没有符合条件的数据";
            }
            else
            {
                this.total = billBeanList.Count;
            }
            return(JsonConvert.SerializeObject(billBeanList, settings));

            #region 测试用
            //表头
            //BillBean bb = new BillBean();
            //bb.number = "TESTOCK0001";
            //bb.creator = new BillObject("whfy");
            //bb.bizDate = DateTime.Now;
            //bb.costCenterOrgUnit = new BillObject("01.05.04.01.11.01.02");
            //bb.description = "测试库存调拨单";
            //bb.storageOrgUnit = new BillObject("01.05.04.01.09");
            //bb.adminOrgUnit = new BillObject("01.05.04.01");
            //bb.stocker = new BillObject("00011846");

            ////表体
            //BillEntryToken bet = new BillEntryToken();
            //bet.material = new BillObject("01.12.02.0003");
            //bet.qty = 2;
            //bet.remark = "测试";
            //bet.customer = new BillObject("37.11.0045");
            //bet.unit = new BillObject("Set");
            //bet.warehouse = new BillObject("YYBB-15-1");

            //bb.entry.Add(bet);

            ////添加到结果中
            //billBeanList.Add(bb);
            //return JsonConvert.SerializeObject(billBeanList);
            #endregion
        }