ration.ts 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374
  1. /* eslint-disable camelcase */
  2. import {
  3. prefix,
  4. fromType,
  5. gljCreateType,
  6. createLocation,
  7. BRType,
  8. } from './base';
  9. import { IBookmark } from './bill';
  10. import { GljType, MaterialType } from './glj';
  11. import { IQuantityDetail } from './quantityDetail';
  12. export interface IStdRationChapter {
  13. rationRepId: number; // 标准库的属性
  14. ID: string; // 补充库的直接用新结构,所以有两种类型
  15. parentID: string;
  16. seq: number;
  17. name: string;
  18. explanation?: string; // 说明
  19. ruleText?: string; // 计算规则,
  20. jobContentSituation?: string; // 工作内容适用情况,ALL适用本项全部定额,PARTIAL适用本项部分定额
  21. annotationSituation?: string; // 附注适用情况,ALL适用本项全部定额,PARTIAL适用本项部分定额
  22. }
  23. export interface ICptRationChapter {
  24. name: string;
  25. ID: string;
  26. seq: number;
  27. parentID: string;
  28. // 以下预留数据,以后开放可用
  29. explanation?: string; // 说明
  30. ruleText?: string; // 计算规则,
  31. jobContentSituation?: string; // 工作内容适用情况,ALL适用本项全部定额,PARTIAL适用本项部分定额
  32. annotationSituation?: string; // 附注适用情况,ALL适用本项全部定额,PARTIAL适用本项部分定额
  33. }
  34. export interface IBaseRationGljRef {
  35. consumeAmt: number;
  36. proportion?: number; // 配合比,暂时无需使用,默认0
  37. type?: fromType; // 可能有数据没有
  38. }
  39. export interface IStdRationGljRef extends IBaseRationGljRef {
  40. gljId: number; // 原std库已经是这样,不能改成ID
  41. }
  42. export interface ICptRationGljRef extends IBaseRationGljRef {
  43. gljId: string; // 原std库已经是这样,不能改成ID
  44. }
  45. export interface IStdRationAss {
  46. name: string;
  47. assistCode: string;
  48. stdValue: string;
  49. stepValue: string;
  50. decimal: number;
  51. carryBit: string;
  52. minValue: string;
  53. maxValue: string;
  54. paramName: string; // 参数名称
  55. param: string; // 参数
  56. thirdRationCode: string; // 第三定额
  57. }
  58. export interface IStdRationInstall {
  59. feeItemId: string; // 原std库已经是这样,不能改成ID
  60. sectionId: string; // 原std库已经是这样,不能改成ID
  61. }
  62. export interface IStdRationTemp {
  63. rationID: number;
  64. type: string;
  65. billsLocation: string;
  66. }
  67. export interface ICoeList {
  68. ID: number;
  69. no: number;
  70. }
  71. export enum CoeType {
  72. RATION = '定额',
  73. LABOUR = '人工',
  74. MATERIAL = '材料',
  75. MACHINE = '机械',
  76. TOOL = '施工机具',
  77. MAIN = '主材',
  78. EQUIPMENT = '设备',
  79. SINGLE = '单个工料机',
  80. REPLACE = '替换人材机',
  81. SELECT = '所选人材机',
  82. }
  83. export interface IStdCoe {
  84. coeType: CoeType; // 系数类型,指作用范围:
  85. // 单个(如:111量0.001)、人工类、材料类、机械类、全部(如:定额×0.925)。
  86. gljID?: number; // 要调整的工料机ID(当coeType=0时有效)
  87. operator: string; // 运算符(*、+、-、=)
  88. amount: string; // 调整的量
  89. gljCode: string;
  90. gljName?: string;
  91. replaceCode?: string;
  92. replaceName?: string;
  93. }
  94. export interface IBaseCoeItem {
  95. ID: number;
  96. serialNo?: number; // 编号
  97. name: string; // 名称
  98. content?: string; // 说明
  99. coes: IStdCoe[];
  100. }
  101. export interface IOptionList {
  102. text: string;
  103. value: string;
  104. }
  105. export interface ICptCoeItem extends IBaseCoeItem {
  106. userID: string;
  107. compilationID: string;
  108. }
  109. export interface IStdCoeItem extends IBaseCoeItem {
  110. libID: number; // 所属定额定ID
  111. original_code?: string; // 原人材机编码
  112. option_codes?: string; // 可选人材机编码
  113. option_list?: IOptionList[]; // 下拉列表选项
  114. }
  115. export interface IRationCoe {
  116. ID: string;
  117. stdID?: number | string; // 库里的ID
  118. name: string;
  119. content?: string;
  120. originalCode?: string;
  121. optionList?: IOptionList[];
  122. optionCodes?: string; // 可选人材机编码
  123. selectCode?: string; // 选中的人材机编码
  124. isAdjust: boolean; // 默认 false
  125. coes: IStdCoe[];
  126. }
  127. export interface IBaseRation {
  128. code: string;
  129. name: string;
  130. unit: string;
  131. basePrice: number;
  132. labourPrice: number;
  133. materialPrice: number;
  134. machinePrice: number;
  135. caption: string;
  136. feeType: number;
  137. jobContent: string;
  138. annotation: string;
  139. manageFeeRate: string; // 管理费费率
  140. rationCoeList: ICoeList[];
  141. rationAssList: IStdRationAss[];
  142. rationInstList: IStdRationInstall[];
  143. rationTemplateList: IStdRationTemp[];
  144. fromType?: fromType; // 单条查找结果时用到
  145. }
  146. export interface IStdRation extends IBaseRation {
  147. ID: number;
  148. rationRepId: number;
  149. sectionId: number;
  150. rationGljList: IStdRationGljRef[];
  151. chapter?: IStdRationChapter;
  152. }
  153. export interface ICptRation extends IBaseRation {
  154. userID: string;
  155. compilationID: string;
  156. ID: string;
  157. sectionId: string;
  158. rationGljList: ICptRationGljRef[];
  159. chapter?: ICptRationChapter;
  160. }
  161. export interface IStdComponent {
  162. ID: number;
  163. consumeAmt: number;
  164. consumeAmtProperty: any; // 多消耗量的情况
  165. }
  166. export interface ICptComponent {
  167. ID: string; // 补充的ID改成了UUID ,标准的不变,但是这里
  168. consumeAmt: number;
  169. consumeAmtProperty: any; // 多消耗量的情况
  170. from: fromType;
  171. }
  172. export interface IBaseRationGlj {
  173. code: string;
  174. name: string;
  175. specs?: string;
  176. basePrice: number;
  177. priceProperty: any; // 多单价的情况
  178. gljClass: number;
  179. type: number; // 这个要和项目工料机等统一,所以在查找项目工料机的时候转一下,
  180. gljType: number;
  181. model: number; // 机型
  182. shortName: string;
  183. unit: string;
  184. adjCoe: number;
  185. materialType: MaterialType; // 三材类别
  186. materialCoe: number; // 三材系数
  187. // 经济指标数据
  188. materialIndexType: string; // 工料指标类别
  189. materialIndexUnit: string; // 工料指标单位
  190. materialIndexCoe: number; // 单位转换系数
  191. taxRate: string; // 税率
  192. }
  193. // 保存到项目下的定额工料机
  194. export interface IRationGlj {
  195. ID: string;
  196. gljID?: string;
  197. repositoryID?: number;
  198. name: string;
  199. code: string;
  200. originalCode: string; // 原始的编码
  201. rcode?: string; // 替换工料机后记录原来的工料机编码,要做判断
  202. specs?: string;
  203. unit: string;
  204. type: GljType;
  205. model?: number; // 机型
  206. adjCoe?: number; // 调整系数ID
  207. quantity: number;
  208. customQuantity?: number;
  209. rationQuantity?: number;
  210. tenderQuantity?: number; // 调整后消耗量
  211. marketPrice?: number; // 市场价 - 不保存至数据库
  212. basePrice?: number; // 定额价 - 不保存至数据库
  213. createType: gljCreateType; // normal、add、replace 正常、添加工料机、替换工料机
  214. from: fromType; // std, cpt 来自标准工料机库、补充工料机库
  215. }
  216. export interface IStdRationGlj extends IBaseRationGlj {
  217. ID: number;
  218. repositoryId: number;
  219. components: IStdComponent[];
  220. }
  221. export interface ICptRationGlj extends IBaseRationGlj {
  222. ID: string;
  223. userID: string;
  224. compilationID: string;
  225. components: ICptComponent[];
  226. }
  227. export interface IGljQtyCoe {
  228. labour: number; // 人工
  229. material: number; // 材料
  230. machine: number; // 机械
  231. main: number; // 主材
  232. equipment: number; // 设备
  233. }
  234. // 实际保存到项目中的辅助定额数据
  235. export interface IRationAss extends IStdRationAss {
  236. ID: string;
  237. actualValue?: number;
  238. isAdjust: boolean; // 是否调整
  239. groupList?: IRationAss[]; // 当有分组的时候用这个
  240. // 这里辅助定额直接保存工料机的数据,用的时候不用再获取
  241. rationGljList?: IRationGlj[]; // 定额工料机
  242. }
  243. export interface ITemplateItem {
  244. ID: string;
  245. code: string;
  246. name: string;
  247. type: string;
  248. defaultLocation: string; // 记录默认给定的清单编号,恢复原始数据时用(目前复制整块)
  249. billsLocation: string; // 这个是清单编号
  250. fxID: string; // 这个是分项对应的ID
  251. unit: string;
  252. quantity: number;
  253. coe: number;
  254. billID?: string; // 记取位置对应的清单ID
  255. }
  256. export interface IRationTemplate {
  257. createLocation: createLocation; // 提取位置
  258. templateList: ITemplateItem[];
  259. }
  260. // 定额安装增加费
  261. export interface IRationInstall {
  262. ID: string;
  263. sectionID: string; // 分册章节id
  264. feeItemID: string;
  265. ruleID: string;
  266. itemName: string;
  267. sectionName: string;
  268. unifiedSetting: boolean; // 0:false 1:true 按统一设置
  269. }
  270. export interface IRation {
  271. ID: string;
  272. parentID: string;
  273. seq: number;
  274. kind: BRType;
  275. code?: string;
  276. name?: string;
  277. unit?: string;
  278. type?: number; // 子类型:1人工、201材料、301机械、4主材、5设备
  279. quantity?: number;
  280. contain?: number; // 含量
  281. quantityEXP?: string; // 工程量表达式
  282. programID?: number;
  283. fees?: any; // 费用字段
  284. gljQtyCoe?: IGljQtyCoe; // 工料机消耗量调整系数字段
  285. rationQtyCoe?: number; // 子目工程量调整系数
  286. tenderQuantity?: string; // 调整后工程量
  287. noAdjustPrice?: boolean; // { type: boolean; default: false }; // 不调价
  288. targetUnitFee?: string; // 目标单价
  289. targetTotalFee?: string; // 目标合价
  290. from?: fromType; // { type: string; default: 'std' }; // std, cpt 来自标准、补充
  291. isSubcontract?: boolean; // 是否分包
  292. installationKey?: string; // 用来记录安装增加费的关联字段
  293. // 定额特有属性:
  294. stdID?: string; // 来自的标准定额ID
  295. repositoryID?: number; // 定额库ID
  296. maskName?: string;
  297. caption?: string;
  298. evaluationProject?: boolean; // { type: boolean; default: false }; // 1 true 0 false 估价项目
  299. adjustState?: string;
  300. comments?: string; // 说明
  301. content?: string; // 工作内容
  302. annotation?: string; // 附注
  303. ruleText?: string; // 计算规则
  304. prefix?: prefix; // { type: string; default: '' }; // 定额是补充、借用时用 补 借
  305. referenceRationID?: string; // 如果是通过模板关联子目生成的定额,这里记录对应的主定额ID
  306. jobContentText?: string; // 工作内容 (选择自清单)
  307. manageFeeRate?: string; // 管理费率
  308. // 是否记取面积增加费
  309. areaIncreaseFee?: boolean | null; // { type: Schema.Types.Mixed; default: false }; // true 是,false否,null 不确定,三个状态
  310. // 工料机特有属性
  311. gljID?: string; // 工料机在库中ID
  312. originalCode?: string; // 原始编码
  313. specs?: string; // 规格型号
  314. customQuantity?: string; // 自定义消耗
  315. model?: number; // 机型
  316. adjCoe?: number;
  317. remark?: string; // 备注
  318. bookmarkBackground?: string; // 书签背景色
  319. bookmarkAnnotation?: string; // 批注
  320. overHeight?: string; // 超高降效
  321. referenceRationList?: any; // { type: Array; default: [] }; // 关联的定额ID列表,如超高子目关联的定额ID列表
  322. // 定额子项
  323. rationGljList?: IRationGlj[]; // 定额工料机
  324. rationAssList?: IRationAss[]; // 辅助定额
  325. quantityDetails?: IQuantityDetail[]; // 工程量明细 -- 原先保存在另外的表中
  326. rationCoeList?: IRationCoe[]; // 定额调整系数
  327. rationTemplate?: IRationTemplate; // 定额模板
  328. rationInstallList?: IRationInstall[]; // 定额安装增加
  329. bookmarks?: IBookmark[];
  330. }
  331. export interface IRations {
  332. projectID: string;
  333. index: number;
  334. rations: IRation[];
  335. }
  336. export interface IStdRationsAndGljs {
  337. rations: (IStdRation | ICptRation)[];
  338. rationGljs: (IStdRationGlj | ICptRationGlj)[];
  339. }
  340. export enum RationListType {
  341. ASS = 'rationAssList',
  342. COE = 'rationCoeList',
  343. GLJ = 'rationGljList',
  344. }