|
|
using NetLibrary.Data;
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
using System.ComponentModel.Design;
|
|
|
using System.Data;
|
|
|
using System.Linq;
|
|
|
using System.Web;
|
|
|
using System.Web.Services;
|
|
|
using TradeManageNew;
|
|
|
|
|
|
namespace ERPOMS
|
|
|
{
|
|
|
/// <summary>
|
|
|
/// OMSCangKuServerNew 的摘要说明
|
|
|
/// </summary>
|
|
|
[WebService(Namespace = "http://tempuri.org/")]
|
|
|
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
|
|
|
[System.ComponentModel.ToolboxItem(false)]
|
|
|
// 若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务,请取消注释以下行。
|
|
|
[System.Web.Script.Services.ScriptService]
|
|
|
public class OMSCangKuServerNew : System.Web.Services.WebService
|
|
|
{
|
|
|
|
|
|
#region 库存申请
|
|
|
// 本模块说明:根据老板的要求,写了一个运营在oms中对自己的分配货号申请库存的功能,用于计算仓储费用
|
|
|
// 应用页面:CK_InventoryApply(OMS,运营申请)和CK_InventoryCheck(ERP,领导审核)
|
|
|
// 开发状态:暂停
|
|
|
#region 查找用户的分配货号
|
|
|
/// <summary>
|
|
|
/// 自动获取登陆者的userid,userid获取对应分配的货号信息
|
|
|
/// 开发状态:暂停
|
|
|
/// </summary>
|
|
|
/// <returns></returns>
|
|
|
[WebMethod(EnableSession = true)]
|
|
|
public List<GoodsBaseModel> GetGoodsListByUserId()
|
|
|
{
|
|
|
PagesNew.Login(this.Session);
|
|
|
int userid = Convert.ToInt32(Session["UserId"]);
|
|
|
return TradeManageNew.DataNew.GetApplyGoodsListByUserId(userid);
|
|
|
|
|
|
}
|
|
|
#endregion
|
|
|
#region 根据货号查找销售价格
|
|
|
/// <summary>
|
|
|
/// 根据GoodsId获取对应的销售价格
|
|
|
/// 开发状态:暂停
|
|
|
/// </summary>
|
|
|
/// <param name="GoodsId"></param>
|
|
|
/// <returns></returns>
|
|
|
[WebMethod(EnableSession = true)]
|
|
|
public decimal GetSalePriceByGoodsId(int GoodsId)
|
|
|
{
|
|
|
PagesNew.Login(this.Session);
|
|
|
return TradeManageNew.DataNew.GetSalePriceByGoodsId(GoodsId);
|
|
|
|
|
|
}
|
|
|
#endregion
|
|
|
#region 保存出库申请
|
|
|
/// <summary>
|
|
|
/// 保存出库申请
|
|
|
/// 开发状态:暂停
|
|
|
/// </summary>
|
|
|
/// <param name="Model"></param>
|
|
|
/// <returns></returns>
|
|
|
[WebMethod(EnableSession = true)]
|
|
|
public string Save_CKInventoryApply(CK_InventoryApply Model)
|
|
|
{
|
|
|
//PagesNew.Login(this.Session);
|
|
|
string result = "";
|
|
|
try
|
|
|
{
|
|
|
//新增
|
|
|
if (Model.Id == 0)
|
|
|
{
|
|
|
Model.ApplyDate = DateTime.Now;
|
|
|
Model.CheckDate = DateTime.Now;
|
|
|
Model.Status = 0;
|
|
|
}
|
|
|
//编辑
|
|
|
else
|
|
|
{
|
|
|
Model.ApplyDate = DateTime.Now;
|
|
|
Model.CheckDate = DateTime.Now;
|
|
|
}
|
|
|
TradeManageNew.DataNew.Save_CKInventoryApply(Model);
|
|
|
}
|
|
|
catch(Exception ex )
|
|
|
{
|
|
|
result = ex.Message;
|
|
|
}
|
|
|
return result;
|
|
|
|
|
|
}
|
|
|
#endregion
|
|
|
#region 分页查询
|
|
|
/// <summary>
|
|
|
/// 查询登录者对应的库存申请信息
|
|
|
/// 开发状态:暂停
|
|
|
/// </summary>
|
|
|
/// <param name="UserId"></param>
|
|
|
/// <param name="Status"></param>
|
|
|
/// <param name="GoodsCode"></param>
|
|
|
/// <param name="sDate"></param>
|
|
|
/// <param name="eDate"></param>
|
|
|
/// <param name="PageIndex"></param>
|
|
|
/// <param name="PageSize"></param>
|
|
|
/// <returns></returns>
|
|
|
[WebMethod(EnableSession = true)]
|
|
|
public JsonModel<List<CK_InventoryApply>> GetPageList_CKInventoryApply(int UserId ,int Status,string GoodsCode, DateTime? sDate, DateTime? eDate, int PageIndex, int PageSize)
|
|
|
{
|
|
|
//PagesNew.Login(this.Session);
|
|
|
var resultModel = new JsonModel<List<CK_InventoryApply>>();
|
|
|
try
|
|
|
{
|
|
|
RefParameterCollection Param = new RefParameterCollection();
|
|
|
#region 查询条件添加
|
|
|
//员工单人
|
|
|
if (UserId != 1)
|
|
|
{
|
|
|
Param.Add("a.UserId", "=", UserId, DbType.Int32);
|
|
|
}
|
|
|
//状态查询
|
|
|
if (Status != -1)
|
|
|
{
|
|
|
Param.Add("a.Status", "=", Status, DbType.Int32);
|
|
|
}
|
|
|
//货号查询
|
|
|
if (!string.IsNullOrEmpty(GoodsCode))
|
|
|
{
|
|
|
Param.Add("b.GoodsCode", "like", GoodsCode, DbType.String);
|
|
|
}
|
|
|
//时间
|
|
|
if (sDate != null)
|
|
|
{
|
|
|
Param.Add("a.ApplyDate", ">=", sDate, DbType.Date);
|
|
|
}
|
|
|
//状态查询
|
|
|
if (eDate != null)
|
|
|
{
|
|
|
Param.Add("a.ApplyDate", "<=", eDate, DbType.Date);
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
int RowCount = 0;
|
|
|
string Sort = "Id";
|
|
|
|
|
|
resultModel.DataSource = TradeManageNew.DataNew.GetPageList_CKInventoryApply(Param, PageIndex, PageSize, Sort, out RowCount);
|
|
|
resultModel.RowCount = RowCount;
|
|
|
}
|
|
|
catch(Exception ex )
|
|
|
{
|
|
|
resultModel.ErrorMsg = ex.Message;
|
|
|
}
|
|
|
return resultModel;
|
|
|
|
|
|
}
|
|
|
#endregion
|
|
|
#region 更新出库申请状态
|
|
|
/// <summary>
|
|
|
/// 更新出库申请状态 编辑
|
|
|
/// 开发状态:暂停
|
|
|
/// </summary>
|
|
|
/// <param name="Id"></param>
|
|
|
/// <param name="Status"></param>
|
|
|
/// <param name="CheckMsg"></param>
|
|
|
/// <returns></returns>
|
|
|
[WebMethod(EnableSession = true)]
|
|
|
public string UpdateStatus_CKInventoryApply(int Id,int Status,string CheckMsg)
|
|
|
{
|
|
|
//PagesNew.Login(this.Session);
|
|
|
string result = "";
|
|
|
try
|
|
|
{
|
|
|
var model = TradeManageNew.DataNew.GetModel_CKInventoryApply(Id);
|
|
|
if (model != null)
|
|
|
{
|
|
|
if (model.Status != 1)
|
|
|
{
|
|
|
model.Status = Status;
|
|
|
if (Status == 1)
|
|
|
{
|
|
|
|
|
|
model.CheckDate = DateTime.Now;
|
|
|
}
|
|
|
else if (Status == 2)
|
|
|
{
|
|
|
model.CheckMsg = CheckMsg;
|
|
|
}
|
|
|
|
|
|
|
|
|
TradeManageNew.DataNew.Save_CKInventoryApply(model);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
result = "本条记录已审核通过,请勿操作!";
|
|
|
}
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
result = "没有查询到对应记录,更新失败";
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
result = ex.Message;
|
|
|
}
|
|
|
return result;
|
|
|
|
|
|
}
|
|
|
#endregion
|
|
|
#region 撤销出库申请
|
|
|
/// <summary>
|
|
|
/// 在状态为通过撤销出库申请
|
|
|
/// 开发状态:暂停
|
|
|
/// </summary>
|
|
|
/// <param name="Id"></param>
|
|
|
/// <returns></returns>
|
|
|
[WebMethod(EnableSession = true)]
|
|
|
public string Cancel_CKInventoryApply(int Id)
|
|
|
{
|
|
|
//PagesNew.Login(this.Session);
|
|
|
string result = "";
|
|
|
try
|
|
|
{
|
|
|
var model = TradeManageNew.DataNew.GetModel_CKInventoryApply(Id);
|
|
|
if (model != null)
|
|
|
{
|
|
|
if (model.Status != 1)
|
|
|
{
|
|
|
|
|
|
TradeManageNew.DataNew.Delete_CKInventoryApply((int)model.Id);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
result = "本条记录已审核通过,请勿操作!";
|
|
|
}
|
|
|
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
result = "没有查询到对应记录,更新失败";
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
catch (Exception ex)
|
|
|
{
|
|
|
result = ex.Message;
|
|
|
}
|
|
|
return result;
|
|
|
|
|
|
}
|
|
|
#endregion
|
|
|
|
|
|
#endregion
|
|
|
}
|
|
|
}
|