internal async Task <JsonResult> PROList(PurchaseReturnOrder pro) { SqlConnection cn = null; try { cn = Connection.GetConnection(); SqlCommand smd = new SqlCommand("SET @jsonOutput = (SELECT 'True' as [condition], gph.document_no, (SELECT vm.vendor_name FROM dbo.vendor_mst vm WHERE vm.vendor_no = gph.party_id) vendor_name," + " sm.name AS order_status, gph.created_date, gph.created_by FROM dbo.gate_pass_header gph INNER JOIN dbo.status_mst sm ON gph.order_status = sm.id " + "WHERE gph.document_type = 'Purchase Return Order' AND gph.from_location_id = @location_id for json path)", cn); smd.Parameters.AddWithValue("@location_id", pro.LocationId); smd.Parameters.Add("@jsonOutput", SqlDbType.NVarChar, -1).Direction = ParameterDirection.Output; await smd.ExecuteNonQueryAsync().ConfigureAwait(false); string json = smd.Parameters["@jsonOutput"].Value.ToString(); smd.Dispose(); if (json.Length > 2) { JArray arr = JArray.Parse(json); return(new JsonResult(arr)); } else { return(await SendRespose("False", "No Record Found").ConfigureAwait(true)); } } catch (Exception) { throw; } finally { Connection.CloseConnection(ref cn); } }
internal async Task <JArray> AddItem(PurchaseReturnOrder pro) { SqlConnection cn = null; try { cn = Connection.GetConnection(); SqlCommand smd = new SqlCommand("sale_order_add_new_item", cn) { CommandType = CommandType.StoredProcedure }; smd.Parameters.Add("@jsonOutput", SqlDbType.NVarChar, -1).Direction = ParameterDirection.Output; smd.Parameters.AddWithValue("@item_no", pro.ItemNo); // Execute the command await smd.ExecuteNonQueryAsync().ConfigureAwait(false); // Get the values string json = smd.Parameters["@jsonOutput"].Value.ToString(); smd.Dispose(); JArray arr = JArray.Parse(json); return(arr); } catch (Exception) { throw; } finally { Connection.CloseConnection(ref cn); } }
public async Task <JsonResult> NewPRONo([FromBody] PurchaseReturnOrder pro) { try { return(await _purchaseReturnOrderLogic.NewPRONo(pro).ConfigureAwait(false)); } catch (Exception ee) { return(await _purchaseReturnOrderLogic.SendRespose("False", ee.Message).ConfigureAwait(false)); } }
/// <summary> /// 查询销售单详细分页 /// </summary> /// <returns></returns> public ActionResult GetDetailList() { string CompanyID = WebUtil.GetFormValue <string>("CompanyID"); int PageIndex = WebUtil.GetFormValue <int>("PageIndex", 1); int PageSize = WebUtil.GetFormValue <int>("PageSize", 10); string OrderNum = WebUtil.GetFormValue <string>("OrderNum"); string SupNum = WebUtil.GetFormValue <string>("SupNum"); string SupName = WebUtil.GetFormValue <string>("SupName"); string Contact = WebUtil.GetFormValue <string>("Contact"); string Phone = WebUtil.GetFormValue <string>("Phone"); string PurchaseSnNum = WebUtil.GetFormValue <string>("PurchaseSnNum"); string PurchaseOrderNum = WebUtil.GetFormValue <string>("PurchaseOrderNum"); string BarCode = WebUtil.GetFormValue <string>("BarCode"); string ProductName = WebUtil.GetFormValue <string>("ProductName"); int Status = WebUtil.GetFormValue <int>("Status", 0); string BeginTime = WebUtil.GetFormValue <string>("BeginTime"); string EndTime = WebUtil.GetFormValue <string>("EndTime"); PurchaseReturnDetailEntity entity = new PurchaseReturnDetailEntity(); entity.OrderNum = OrderNum; entity.SupNum = SupNum; entity.SupName = SupName; entity.Contact = Contact; entity.Phone = Phone; entity.PurchaseOrderNum = PurchaseOrderNum; entity.PurchaseSnNum = PurchaseSnNum; entity.BarCode = BarCode; entity.ProductName = ProductName; entity.Status = Status; entity.BeginTime = BeginTime; entity.EndTime = EndTime; PageInfo pageInfo = new PageInfo() { PageIndex = PageIndex, PageSize = PageSize }; Bill <PurchaseReturnEntity, PurchaseReturnDetailEntity> bill = new PurchaseReturnOrder(CompanyID); List <PurchaseReturnDetailEntity> listResult = bill.GetDetailList(entity, ref pageInfo); DataListResult <PurchaseReturnDetailEntity> dataResult = new DataListResult <PurchaseReturnDetailEntity>() { Code = (int)EResponseCode.Success, Message = "响应成功", Result = listResult, PageInfo = pageInfo }; return(Content(JsonHelper.SerializeObject(dataResult))); }
/// <summary> /// 查询采购退货单 /// </summary> /// <returns></returns> public ActionResult GetOrder() { string SnNum = WebUtil.GetFormValue <string>("SnNum"); string CompanyID = WebUtil.GetFormValue <string>("CompanyID", string.Empty); PurchaseReturnEntity entity = new PurchaseReturnEntity(); entity.SnNum = SnNum; entity.CompanyID = CompanyID; Bill <PurchaseReturnEntity, PurchaseReturnDetailEntity> bill = new PurchaseReturnOrder(CompanyID); PurchaseReturnEntity result = bill.GetOrder(entity); DataResult <PurchaseReturnEntity> dataResult = new DataResult <PurchaseReturnEntity>(); dataResult.Code = (int)EResponseCode.Success; dataResult.Message = "响应成功"; dataResult.Result = result; return(Content(JsonHelper.SerializeObject(dataResult))); }
/// <summary> /// 删除销售退货单 /// </summary> /// <returns></returns> public ActionResult Delete() { List <string> list = WebUtil.GetFormObject <List <string> >("list"); string CompanyID = WebUtil.GetFormValue <string>("CompanyID", string.Empty); Bill <PurchaseReturnEntity, PurchaseReturnDetailEntity> bill = new PurchaseReturnOrder(CompanyID); string returnValue = bill.Delete(list); DataResult result = new DataResult(); if (EnumHelper.GetEnumDesc <EReturnStatus>(EReturnStatus.Success) == returnValue) { result.Code = (int)EResponseCode.Success; result.Message = "销售退货单删除成功"; } else { result.Code = (int)EResponseCode.Exception; result.Message = "销售退货单删除失败"; } return(Content(JsonHelper.SerializeObject(result))); }
/// <summary> /// 审核采购退货单 /// </summary> /// <returns></returns> public ActionResult Audite() { string SnNum = WebUtil.GetFormValue <string>("SnNum"); string CompanyID = WebUtil.GetFormValue <string>("CompanyID", string.Empty); int Status = WebUtil.GetFormValue <int>("Status", (int)EAudite.NotPass); string AuditUser = WebUtil.GetFormValue <string>("AuditUser", string.Empty); string Reason = WebUtil.GetFormValue <string>("Reason", string.Empty); int OperateType = WebUtil.GetFormValue <int>("OperateType", 0); string EquipmentNum = WebUtil.GetFormValue <string>("EquipmentNum"); string EquipmentCode = WebUtil.GetFormValue <string>("EquipmentCode"); string Remark = WebUtil.GetFormValue <string>("Remark"); PurchaseReturnEntity entity = new PurchaseReturnEntity(); entity.SnNum = SnNum; entity.CompanyID = CompanyID; entity.Status = Status; entity.Reason = Reason; entity.Remark = Remark; Bill <PurchaseReturnEntity, PurchaseReturnDetailEntity> bill = new PurchaseReturnOrder(CompanyID); string returnValue = bill.Audite(entity); DataResult result = new DataResult(); if ("1000" == returnValue) { result.Code = (int)EResponseCode.Success; result.Message = "操作成功"; } else if ("1001" == returnValue) { result.Code = (int)EResponseCode.Exception; result.Message = "采购退货单不存在"; } else if ("1002" == returnValue) { result.Code = (int)EResponseCode.Exception; result.Message = "采购退货单已经审核"; } return(Content(JsonHelper.SerializeObject(result))); }
internal async Task <JsonResult> NewPRONo(PurchaseReturnOrder pro) { SqlConnection cn = null; try { cn = Connection.GetConnection(); SqlCommand smd = new SqlCommand("SELECT CONCAT( dp.prefix , NEXT VALUE FOR dbo.seq_pro) FROM dbo.document_perfix dp WHERE dp.type = 'PurchaseReturn'", cn); string num = (string)await smd.ExecuteScalarAsync().ConfigureAwait(false); return(await SendRespose("True", num).ConfigureAwait(true)); } catch (Exception) { throw; } finally { Connection.CloseConnection(ref cn); } }
public async Task <JsonResult> AddItem([FromBody] PurchaseReturnOrder pro) { try { try { if (string.IsNullOrEmpty(pro.ItemNo)) { return(await _purchaseReturnOrderLogic.SendRespose("False", "Blank Item No").ConfigureAwait(false)); } JArray item_info = await _purchaseReturnOrderLogic.AddItem(pro).ConfigureAwait(false); JObject jo = item_info.Children <JObject>().FirstOrDefault(o => o["condition"] != null); if (jo.Value <string>("condition") == "True") { decimal cost_per_unit, gst_percentage; cost_per_unit = jo.Value <decimal>("cost_per_unit"); gst_percentage = jo.Value <decimal>("gst_percentage"); jo.Add(new JProperty("quantity", pro.Quantity)); jo.Add(new JProperty("amount_without_tax", decimal.Round((cost_per_unit * pro.Quantity), 2))); jo.Add(new JProperty("gst_amount", decimal.Round((jo.Value <decimal>("amount_without_tax") * gst_percentage) / 100, 2))); jo.Add(new JProperty("amount_with_tax", decimal.Round(jo.Value <decimal>("amount_without_tax") + jo.Value <decimal>("gst_amount"), 2))); JArray response = new JArray(jo); return(new JsonResult(response)); } else { return(new JsonResult(item_info)); } } catch (Exception ee) { return(await _purchaseReturnOrderLogic.SendRespose("False", ee.Message).ConfigureAwait(false)); } } catch (Exception ee) { return(await _purchaseReturnOrderLogic.SendRespose("False", ee.Message).ConfigureAwait(false)); } }
/// <summary> /// 创建采购退货单 /// </summary> /// <returns></returns> public ActionResult Create() { string CompanyID = WebUtil.GetFormValue <string>("CompanyID", string.Empty); PurchaseReturnEntity entity = WebUtil.GetFormObject <PurchaseReturnEntity>("Entity"); List <PurchaseReturnDetailEntity> list = WebUtil.GetFormObject <List <PurchaseReturnDetailEntity> >("List"); entity.CompanyID = entity.CompanyID.IsEmpty() ? CompanyID : entity.CompanyID; Bill <PurchaseReturnEntity, PurchaseReturnDetailEntity> bill = new PurchaseReturnOrder(CompanyID); string returnValue = bill.Create(entity, list); DataResult result = new DataResult(); if (EnumHelper.GetEnumDesc <EReturnStatus>(EReturnStatus.Success) == returnValue) { result.Code = (int)EResponseCode.Success; result.Message = "采购退货单创建成功"; } else { result.Code = (int)EResponseCode.Exception; result.Message = "采购退货单创建失败"; } return(Content(JsonHelper.SerializeObject(result))); }
/// <summary> /// 取消采购退货单 /// </summary> /// <returns></returns> public ActionResult Cancel() { string SnNum = WebUtil.GetFormValue <string>("SnNum"); string CompanyID = WebUtil.GetFormValue <string>("CompanyID", string.Empty); PurchaseReturnEntity entity = new PurchaseReturnEntity(); entity.SnNum = SnNum; entity.CompanyID = CompanyID; Bill <PurchaseReturnEntity, PurchaseReturnDetailEntity> bill = new PurchaseReturnOrder(CompanyID); string returnValue = bill.Cancel(entity); DataResult result = new DataResult(); if (EnumHelper.GetEnumDesc <EReturnStatus>(EReturnStatus.Success) == returnValue) { result.Code = (int)EResponseCode.Success; result.Message = "操作成功"; } else { result.Code = (int)EResponseCode.Exception; result.Message = "操作失败"; } return(Content(JsonHelper.SerializeObject(result))); }