/// <summary> /// 收货单据管理,打印--查询订单主表信息 /// </summary> /// <param name="billID"></param> /// <returns></returns> public AsnHeaderEntity GetBillHeader(int billID) { AsnBodyEntity tm = new AsnBodyEntity(); try { #region 请求数据 System.Text.StringBuilder loStr = new System.Text.StringBuilder(); loStr.Append("billId=").Append(billID); string jsonQuery = WebWork.SendRequest(loStr.ToString(), WebWork.URL_GetBillHeader); if (string.IsNullOrEmpty(jsonQuery)) { MsgBox.Warn(WebWork.RESULT_NULL); //LogHelper.InfoLog(WebWork.RESULT_NULL); return(tm); } #endregion #region 正常错误处理 JsonBills bill = JsonConvert.DeserializeObject <JsonBills>(jsonQuery); if (bill == null) { MsgBox.Warn(WebWork.JSON_DATA_NULL); return(tm); } if (bill.flag != 0) { MsgBox.Warn(bill.error); return(tm); } #endregion List <AsnBodyEntity> list = new List <AsnBodyEntity>(); #region 赋值数据 foreach (JsonBillsResult jbr in bill.result) { AsnBodyEntity asnEntity = new AsnBodyEntity(); asnEntity.OriginalBillNO = jbr.originalBillNo; asnEntity.InstoreTypeDesc = jbr.instoreTypeDesc; asnEntity.Creator = jbr.creator; asnEntity.InstoreType = jbr.instoreType; asnEntity.ContractNO = jbr.contractNo; asnEntity.BillType = jbr.billType; //nameS asnEntity.RowForeColor = Convert.ToInt32(jbr.rowColor); asnEntity.BillState = jbr.billState; asnEntity.BillStateDesc = jbr.billStateDesc; asnEntity.Remark = jbr.remark; #region try { if (!string.IsNullOrEmpty(jbr.closeDate)) { asnEntity.CloseDate = Convert.ToDateTime(jbr.closeDate); } } catch (Exception msg) { MsgBox.Warn(msg.Message); //LogHelper.errorLog("RepAsnTransfer+GetBillHeader", msg); } #endregion #region try { if (!string.IsNullOrEmpty(jbr.printedTime)) { asnEntity.PrintedTime = Convert.ToDateTime(jbr.printedTime); } } catch (Exception msg) { MsgBox.Warn(msg.Message); //LogHelper.errorLog("RepAsnTransfer+GetBillHeader", msg); } #endregion #region try { if (!string.IsNullOrEmpty(jbr.createDate)) { asnEntity.CreateDate = Convert.ToDateTime(jbr.createDate); } } catch (Exception msg) { MsgBox.Warn(msg.Message); //LogHelper.errorLog("RepAsnTransfer+GetBillHeader", msg); } #endregion asnEntity.WmsRemark = jbr.wmsRemark; asnEntity.Printed = Convert.ToInt32(jbr.printed); //sCode //asnEntity.SupplierCode = jbr.cName; asnEntity.SupplierName = jbr.cName; asnEntity.BillID = Convert.ToInt32(jbr.billId); asnEntity.BillNO = jbr.billNo; asnEntity.Sales = jbr.salesMan; asnEntity.BillTypeDesc = jbr.billTypeDesc; list.Add(asnEntity); } if (list.Count > 0) { return(list[0]); } #endregion } catch (Exception ex) { MsgBox.Err(ex.Message); } return(tm); }
/// <summary> /// 读取等待到货(也就是没有做到货登记)的单据 /// </summary> /// <param name="warehouseCode"></param> /// <returns></returns> private List <AsnBodyEntity> QueryNotRelatedBills(string warehouseCode) { List <AsnBodyEntity> list = new List <AsnBodyEntity>(); try { #region 请求数据 System.Text.StringBuilder loStr = new System.Text.StringBuilder(); loStr.Append("billState=").Append(BillStateConst.ASN_STATE_CODE_NOT_ARRIVE).Append("&"); loStr.Append("wareHouseCode=").Append(warehouseCode); string jsonQuery = WebWork.SendRequest(loStr.ToString(), WebWork.URL_QueryNotRelatedBills); if (string.IsNullOrEmpty(jsonQuery)) { MsgBox.Warn(WebWork.RESULT_NULL); //LogHelper.InfoLog(WebWork.RESULT_NULL); return(list); } #endregion #region 正常错误处理 JsonBills bill = JsonConvert.DeserializeObject <JsonBills>(jsonQuery); if (bill == null) { MsgBox.Warn(WebWork.JSON_DATA_NULL); return(list); } if (bill.flag != 0) { MsgBox.Warn(bill.error); return(list); } #endregion #region 赋值数据 foreach (JsonBillsResult jbr in bill.result) { AsnBodyEntity asnEntity = new AsnBodyEntity(); asnEntity.OriginalBillNO = jbr.originalBillNo; asnEntity.InstoreTypeDesc = jbr.instoreTypeDesc; asnEntity.Creator = jbr.creator; asnEntity.InstoreType = jbr.instoreType; asnEntity.ContractNO = jbr.contractNo; asnEntity.BillType = jbr.billType; //nameS asnEntity.RowForeColor = Convert.ToInt32(jbr.rowColor); asnEntity.BillState = jbr.billState; asnEntity.BillStateDesc = jbr.billStateDesc; asnEntity.Remark = jbr.remark; #region try { if (!string.IsNullOrEmpty(jbr.closeDate)) { asnEntity.CloseDate = Convert.ToDateTime(jbr.closeDate); } } catch (Exception msg) { MsgBox.Warn(msg.Message); //LogHelper.errorLog("FrmVehicle+QueryNotRelatedBills", msg); } #endregion #region try { if (!string.IsNullOrEmpty(jbr.printedTime)) { asnEntity.PrintedTime = Convert.ToDateTime(jbr.printedTime); } } catch (Exception msg) { MsgBox.Warn(msg.Message); //LogHelper.errorLog("FrmVehicle+QueryNotRelatedBills", msg); } #endregion #region try { if (!string.IsNullOrEmpty(jbr.createDate)) { asnEntity.CreateDate = Convert.ToDateTime(jbr.createDate); } } catch (Exception msg) { MsgBox.Warn(msg.Message); //LogHelper.errorLog("FrmVehicle+QueryNotRelatedBills", msg); } #endregion asnEntity.WmsRemark = jbr.wmsRemark; asnEntity.Printed = Convert.ToInt32(jbr.printed); //sCode //asnEntity.SupplierCode = jbr.cName; asnEntity.SupplierName = jbr.cName; asnEntity.BillID = Convert.ToInt32(jbr.billId); asnEntity.BillNO = jbr.billNo; asnEntity.Sales = jbr.salesMan; asnEntity.BillTypeDesc = jbr.billTypeDesc; list.Add(asnEntity); } return(list); #endregion } catch (Exception ex) { MsgBox.Err(ex.Message); } return(list); }
/// <summary> /// 收货单据管理, 多条件查询 /// </summary> /// <param name="warehouseCode"></param> /// <param name="billID"></param> /// <param name="poNO"></param> /// <param name="billState"></param> /// <param name="supplier"></param> /// <param name="billType"></param> /// <param name="material"></param> /// <param name="sales"></param> /// <param name="dateFrom"></param> /// <param name="dateTo"></param> /// <param name="dateComFrom"></param> /// <param name="dateComTo"></param> /// <returns></returns> public List <AsnBodyEntity> QueryBills(string warehouseCode, string billID, string poNO, string billState, string supplier, string billType, string material, string sales, DateTime?dateFrom, DateTime?dateTo, DateTime?dateComFrom, DateTime?dateComTo) { #region 组装slq条件 //string strWhereCondition = "WHERE H.WH_CODE = @WH_CODE"; ////建单日期 //if (dateFrom.HasValue) //{ // strWhereCondition += " AND H.CREATE_DATE >= @P_CREATE_DATE_FROM"; //} //if (dateTo.HasValue) //{ // strWhereCondition += " AND H.CREATE_DATE <= @P_CREATE_DATE_TO"; //} ////最后更新日期 //if (dateComFrom.HasValue) //{ // strWhereCondition += " AND H.LAST_UPDATETIME >= @P_CLODE_DATE_FROM"; //} //if (dateComTo.HasValue) //{ // strWhereCondition += " AND H.LAST_UPDATETIME <= @P_CLODE_DATE_TO"; //} ////单据编号 //if (!string.IsNullOrEmpty(billID)) //{ // strWhereCondition += " AND H.BILL_NO = @P_BILL_NO"; //} ////原采购单编号 //if (!string.IsNullOrEmpty(poNO)) //{ // strWhereCondition += " AND H.PO_NO = @P_PO_NO"; //} ////供应商 //if (!string.IsNullOrEmpty(supplier)) //{ // strWhereCondition += " AND H.SUPPLIER = @P_SUPPLIER"; //} ////业务类型 //if (!string.IsNullOrEmpty(billType)) //{ // strWhereCondition += " AND H.BILL_TYPE = @P_BILL_TYPE"; //} ////业务员 //if (!string.IsNullOrEmpty(sales)) //{ // strWhereCondition += " AND H.SALES = @P_SALES"; //} ////状态有可能是多个,这个需要转换为OR,直接拼接成字符串,不用参数了 //if (!string.IsNullOrEmpty(billState)) //{ // //假设billState=12,13,15,函数FormatParameter转换为BILL_STATE = '12' OR BILL_STATE = '13' OR BILL_STATE = '15' // strWhereCondition += string.Concat(" AND (", DBUtil.FormatParameter("H.BILL_STATE", billState), ")"); //} ////物料编码或名称,支持模糊查询,因为物料在明细表中,反查出的主表数据会重复,所以要用DISTINCT ////另外不要使用字段拼接,oracle和sql的语法不一样 //if (!string.IsNullOrEmpty(material)) //{ // strWhereCondition += " AND EXISTS(SELECT 1 FROM WM_ASN_DETAIL D INNER JOIN WM_MATERIALS M ON D.MTL_CODE = M.MTL_CODE WHERE H.BILL_ID = D.BILL_ID AND (D.MTL_CODE like @P_MTL_CODE OR M.MTL_NAME LIKE @P_MTL_CODE OR M.MTL_NAME_S LIKE @P_MTL_CODE OR M.NAME_PY LIKE @P_MTL_CODE))"; //} #endregion List <AsnBodyEntity> list = new List <AsnBodyEntity>(); try { #region 请求数据 System.Text.StringBuilder loStr = new System.Text.StringBuilder(); loStr.Append("warehouseCode=").Append(warehouseCode).Append("&"); loStr.Append("dateFrom=").Append(dateFrom).Append("&"); loStr.Append("dateTo=").Append(dateTo).Append("&"); loStr.Append("dateComFrom=").Append(dateComFrom).Append("&"); loStr.Append("dateComTo=").Append(dateComTo).Append("&"); loStr.Append("billID=").Append(billID).Append("&"); loStr.Append("poNO=").Append(poNO).Append("&"); loStr.Append("billState=").Append(billState).Append("&"); loStr.Append("billType=").Append(billType).Append("&"); loStr.Append("material=").Append(material).Append("&"); loStr.Append("sales=").Append(sales).Append("&"); loStr.Append("supplier=").Append(supplier); string jsonQuery = WebWork.SendRequest(loStr.ToString(), WebWork.URL_QueryBills); if (string.IsNullOrEmpty(jsonQuery)) { MsgBox.Warn(WebWork.RESULT_NULL); //LogHelper.InfoLog(WebWork.RESULT_NULL); return(list); } #endregion #region 正常错误处理 JsonBills bill = JsonConvert.DeserializeObject <JsonBills>(jsonQuery); if (bill == null) { MsgBox.Warn(WebWork.JSON_DATA_NULL); return(list); } if (bill.flag != 0) { MsgBox.Warn(bill.error); return(list); } #endregion #region 赋值数据 foreach (JsonBillsResult jbr in bill.result) { AsnBodyEntity asnEntity = new AsnBodyEntity(); asnEntity.OriginalBillNO = jbr.originalBillNo; asnEntity.InstoreTypeDesc = jbr.instoreTypeDesc; asnEntity.Creator = jbr.creator; asnEntity.InstoreType = jbr.instoreType; asnEntity.ContractNO = jbr.contractNo; asnEntity.BillType = jbr.billType; //nameS asnEntity.RowForeColor = Convert.ToInt32(jbr.rowColor); asnEntity.BillState = jbr.billState; asnEntity.BillStateDesc = jbr.billStateDesc; asnEntity.Remark = jbr.remark; try { if (!string.IsNullOrEmpty(jbr.closeDate)) { asnEntity.CloseDate = Convert.ToDateTime(jbr.closeDate); } } catch (Exception msg) { MsgBox.Warn(msg.Message); //LogHelper.errorLog("UcAsnQueryEngine+QueryBills", msg); } try { if (!string.IsNullOrEmpty(jbr.printedTime)) { asnEntity.PrintedTime = Convert.ToDateTime(jbr.printedTime); } } catch (Exception msg) { MsgBox.Warn(msg.Message); //LogHelper.errorLog("UcAsnQueryEngine+QueryBills", msg); } try { if (!string.IsNullOrEmpty(jbr.createDate)) { asnEntity.CreateDate = Convert.ToDateTime(jbr.createDate); } } catch (Exception msg) { MsgBox.Warn(msg.Message); //LogHelper.errorLog("UcAsnQueryEngine+QueryBills", msg); } asnEntity.WmsRemark = jbr.wmsRemark; asnEntity.Printed = Convert.ToInt32(jbr.printed); //sCode //asnEntity.SupplierCode = jbr.cName; asnEntity.SupplierName = jbr.cName; asnEntity.BillID = Convert.ToInt32(jbr.billId); asnEntity.BillNO = jbr.billNo; asnEntity.Sales = jbr.salesMan; asnEntity.BillTypeDesc = jbr.billTypeDesc; list.Add(asnEntity); } return(list); #endregion } catch (Exception ex) { MsgBox.Err(ex.Message); } return(list); }