New file |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Web; |
| | | |
| | | namespace WebAPI.Models |
| | | { |
| | | public class M_Process |
| | | { |
| | | public int HItemID { get; set; } |
| | | /// <summary> |
| | | /// 工序代码 |
| | | /// </summary> |
| | | public string HNumber { get; set; } |
| | | /// <summary> |
| | | /// 工序名称 |
| | | /// </summary> |
| | | public string HName { get; set; } |
| | | /// <summary> |
| | | /// 工序等级 |
| | | /// </summary> |
| | | public int HLevel { get; set; } |
| | | /// <summary> |
| | | /// 流转标记 |
| | | /// </summary> |
| | | public int HTypeFlow { get; set; } |
| | | /// <summary> |
| | | /// 核算标记 |
| | | /// </summary> |
| | | public int HTypeCount { get; set; } |
| | | /// <summary> |
| | | /// 汇报类型 |
| | | /// </summary> |
| | | public string HBillSubType { get; set; } |
| | | /// <summary> |
| | | /// 明细标记 |
| | | /// </summary> |
| | | public int HEndFlag { get; set; } |
| | | /// <summary> |
| | | /// 禁用标记 |
| | | /// </summary> |
| | | public int HStopFlag { get; set; } |
| | | /// <summary> |
| | | /// 部门 |
| | | /// </summary> |
| | | public string DepartName { get; set; } |
| | | /// <summary> |
| | | /// 序号 |
| | | /// </summary> |
| | | public int HSNo { get; set; } |
| | | /// <summary> |
| | | /// 对应K3代码 |
| | | /// </summary> |
| | | public int HProcessID_K3 { get; set; } |
| | | /// <summary> |
| | | /// 班产定额 |
| | | /// </summary> |
| | | public decimal HFixPrice { get; set; } |
| | | /// <summary> |
| | | /// 加班补贴定额 |
| | | /// </summary> |
| | | public decimal HOverFixPrice { get; set; } |
| | | /// <summary> |
| | | /// 自动移转 |
| | | /// </summary> |
| | | public int HAutoTrunFlag { get; set; } |
| | | /// <summary> |
| | | /// 备注 |
| | | /// </summary> |
| | | public string HRemark { get; set; } |
| | | } |
| | | } |
New file |
| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Web; |
| | | using WebAPI.Dapper; |
| | | |
| | | namespace WebAPI.Service |
| | | { |
| | | public class ProcessDal |
| | | { |
| | | public static List<Models.M_StationBillMail> GetProcessList(string hName,int hLevel,string hNumber,string hBillSubType) |
| | | { |
| | | var sqlBuilder = new StringBuilder(); |
| | | sqlBuilder.Append("select a.HItemID,a.HNumber,a.HName ,a.HLevel,a.HTypeFlow ,a.HTypeCount ,a.HBillSubType "); |
| | | sqlBuilder.Append(",a.HEndFlag,a.HStopFlag,b.hname,a.HSNo,a.HProcessID_K3,a.HFixPrice,a.HOverFixPrice "); |
| | | sqlBuilder.Append(",a.HEndFlag,a.HStopFlag,b.hname,a.HSNo,a.HProcessID_K3,a.HFixPrice,a.HOverFixPrice "); |
| | | sqlBuilder.Append(",a.HAutoTrunFlag,a.HRemark ,a.HProcessID_K3 from gy_Process a left join h_v_IF_Department b on a.HDeptID=b.hitemid where 1=1 "); |
| | | if (!string.IsNullOrEmpty(hName)) |
| | | sqlBuilder.Append(" and a.HName like '%@hName%'"); |
| | | if(!string.IsNullOrEmpty(hNumber)) |
| | | sqlBuilder.Append(" and a.HNumbe like '%@hNumber%'"); |
| | | if (!string.IsNullOrEmpty(hBillSubType)) |
| | | sqlBuilder.Append(" and a.HBillSubType like '%@hBillSubType%'"); |
| | | if(hLevel!=0) |
| | | sqlBuilder.Append(" and a.HLevel=@hLevel"); |
| | | var list = SqlPools.GetInstance("YqnConn").GetModelList<Models.M_StationBillMail>(sqlBuilder.ToString(), new { hName, hLevel, hNumber, hBillSubType }); |
| | | return list; |
| | | } |
| | | public static Models.M_StationBillMail GetProcessDetail(int hItemID) |
| | | { |
| | | var sql = "select HNumber,HHelpCode,HName,HNumber,HDeptID,HProcMulID,HRemark,HSNo,HFixPrice,HOverFixPrice,HBillSubType,HStopflag, HTypeFlow, HTypeCount, HAutoTrunFlag, HItemID from Gy_Process where HItemID=@hItemID"; |
| | | var model = SqlPools.GetInstance("YqnConn").GetModel<Models.M_StationBillMail>(sql, new { hItemID }); |
| | | return model; |
| | | } |
| | | } |
| | | } |
| | |
| | | /// </summary> |
| | | public static ApiResult SetStationOutBill(StationOutBillView omodel) |
| | | { |
| | | if (!dicLock.TryAdd(omodel.HBillNo, omodel.HBillNo))//同一单号并发处理 |
| | | if (!dicLock.TryAdd(omodel.HICMOBillNo + "cz", omodel.HBillNo))//同一单号并发处理 |
| | | return new ApiResult { code = -1, msg = "服务器繁忙" }; |
| | | var stationInBillModel = YqnDal.GetStationInBillMail(omodel.HProcID, omodel.HICMOBillNo); |
| | | if (stationInBillModel == null) |
| | | return new ApiResult { code = -1, msg = "该工序进站单不存在" }; |
| | | var stationOutBillModel = YqnDal.GetStationOutBillMail(omodel.HProcID, omodel.HICMOBillNo); |
| | | if (stationOutBillModel != null) |
| | | return new ApiResult { code = -1, msg = "该工序已存在出站单" }; |
| | | omodel.HYear = DateTime.Now.Year; |
| | | var result = SetOutBill(omodel); |
| | | return result; |
| | | try |
| | | { |
| | | var stationInBillModel = YqnDal.GetStationInBillMail(omodel.HProcID, omodel.HICMOBillNo); |
| | | if (stationInBillModel == null) |
| | | return new ApiResult { code = -1, msg = "该工序进站单不存在" }; |
| | | var stationOutBillModel = YqnDal.GetStationOutBillMail(omodel.HProcID, omodel.HICMOBillNo); |
| | | if (stationOutBillModel != null) |
| | | return new ApiResult { code = -1, msg = "该工序已存在出站单" }; |
| | | omodel.HYear = DateTime.Now.Year; |
| | | var result = SetOutBill(omodel); |
| | | return result; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return new ApiResult { code = -1, msg = ex.ToString() }; |
| | | } |
| | | finally |
| | | { |
| | | dicLock.TryRemove(omodel.HICMOBillNo + "cz", out string key); |
| | | } |
| | | |
| | | } |
| | | #region sql语句 |
| | | public static DataSet GetStationOutBill(string strWhere) |
| | |
| | | <Compile Include="Models\ApiResult.cs" /> |
| | | <Compile Include="Models\DocumentsView.cs" /> |
| | | <Compile Include="Models\M_StationBillMail.cs" /> |
| | | <Compile Include="Models\M_Process.cs" /> |
| | | <Compile Include="Models\StationOutBillView.cs" /> |
| | | <Compile Include="Properties\Resources.Designer.cs"> |
| | | <AutoGen>True</AutoGen> |
| | |
| | | <DesignTimeSharedInput>True</DesignTimeSharedInput> |
| | | <DependentUpon>Settings.settings</DependentUpon> |
| | | </Compile> |
| | | <Compile Include="Service\ProcessDal.cs" /> |
| | | <Compile Include="Service\YqnDal.cs" /> |
| | | <Compile Include="Service\YqnQbService.cs" /> |
| | | <Compile Include="Web References\WebS\Reference.cs"> |